Link to home
Start Free TrialLog in
Avatar of jrrandle
jrrandle

asked on

Problem with BM_CLICK

Hello experts!
I am having problems clicking a button in another application. I have tried using SendMessage, and even though i see the message arrive at the button in Spy++, it does not respond?!

Thankyou in advance,
James.
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Perhaps the "button" you are trying to click is not really a button at all but another type of control that just looks like a button.

You could try sending WM_LBUTTONDOWN followed by WM_LBUTTONUP.

    private const UInt32 WM_LBUTTONDOWN = 0x201;
    private const UInt32 WM_LBUTTONUP = 0x202;
Avatar of jrrandle
jrrandle

ASKER

Idle Mind,
Thanks for your reply. That still doesn't work, and it's definitely a button (WindowsForms10.BUTTON.app3). I have observed all the messages sent to the button when i actually click it, and even replicated them (to the letter) but the application refuses to accept the click.

Interestingly, that code does work on a non .NET app? and also on a textbox in the same app, just not on the button... :o(

Do you have any other ideas?

Cheers again,
James.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Idle,
It is now working?! Weird. BM_CLICK doesn't work, but LBUTTONDOWN LBUTTONUP works if i put a small delay in (100ms).

The points are yours - thanks for your help,
James.