1 year ago

#380190

test-img

Yind

SendMessage PostMessage to simulate click on other application won't fire the Click event

I'm trying to build a program that simulates the click in a PictureBox of another app.

The target app is built in VB6.

I have develop a test app to see what happen in the events of the PictureBox when I try to send the events.

I'm using this code in C#:


SendMessage(0x007E147C, WM_LBUTTONDOWN, 1, fMakeLong(150,150));

Thread.Sleep(100);

SendMessage(0x007E147C, WM_LBUTTONUP, 0, fMakeLong(150,150));

0x007E147C is the handle of the PictureBox, I got it with Spy++.

if I click the PictureBox in the app I got this in the log:

MouseDown: 1 0 337 155

MouseUp: 1 0 337 155

Click

1 fire for MouseDown, 1 for MouseUp and 1 for Click.

But if I send the messages I only get the MouseDown and MouseUp events but not the Click event.

If I use the message: WM_LBUTTONDBLCLK I can simulate the DblClick event, but there is no message for the simple click, at least that I know of.

Is there any other message I need to send to simulate that event?

Thanks.

c#

events

vb6

sendmessage

0 Answers

Your Answer

Accepted video resources