昨日の夜、つまづいてたところ。
ちょこっと試してみたら普通に動いた
貼っておきます。ペタ
sub MouseClickToolbar { my $toolbar = shift; my $id_target = shift; my $tbb_buf = AllocateVirtualBuffer($win, 24); my $count = SendMessage($toolbar1, 0x418, 0, 0); # TB_BUTTONCOUNT for (my $i = 0; $i < $count; $i ++) { SendMessage($toolbar1, 0x417, $i, $tbb_buf->{'ptr'}); # TB_GETBUTTON my ($bitmap, $id_command, $state) = unpack 'i2 c', ReadFromVirtualBuffer($tbb_buf, 24); next if ($state & 0x8 or !($state & 0x4));# TBSTATE_HIDDEN or !TBSTATE_ENABLE if ($id_command == $id_target) { my $rect_buf = AllocateVirtualBuffer($win, 16); SendMessage($toolbar1, 0x41d, $i, $rect_buf->{'ptr'}); # TB_GETITEMRECT my ($left, $top, $right, $bottom) = unpack 'L4', ReadFromVirtualBuffer($rect_buf, 16); my ($x, $y) = GetWindowRect($toolbar); MouseMoveAbsPix($x + $left + 1, $y + $top + 1); SendLButtonDown(); SendLButtonUp(); FreeVirtualBuffer($rect_buf); last; } } FreeVirtualBuffer($tbb_buf)