Home > Back-end >  For help, inter-process messaging problems
For help, inter-process messaging problems

Time:10-02

Have a goal software, I want to write a program to use the API across processes to automatic control it

I watched structure, first spy++ seems to be written in Delphi

After the handle to get the target software mainhwd
Try shortcut keys
: : PostMessage (mainhwd, WM_KEYDOWN, VK_F3, 0);
It's OK

For child Windows to Edit or TCodeEdit class controls
: : SendMessage (HWD, WM_SETFOCUS, 0, 0).
Sleep (300);
: : SendMessage (HWD, WM_SETTEXT, 0, LPARAM (" 33.3 "));
This is also OK

But then I don't come, button seems to uncontrolled
After get the Button Id
: : PostMessage (HWD, WM_COMMAND MAKEWPARAM (0 x313ac, BN_CLICKED), NULL);
Failed

And then there are several buttons are covered in TPanel, Spy++ also points out, also can't control the
So I want to use the mouse to simulate click event
: : PostMessage (mainhwd WM_LBUTTONDOWN, 0, MAKELPARAM (100100));
Sleep (300);
: : PostMessage (mainhwd WM_LBUTTONUP, 0, MAKELPARAM (100100));
Failure is invalid

Turn the button and the mouse to click the how to control?

CodePudding user response:

About the key, I used KEYDOWN no, it is ok to use the mouse to press again raise,
About TPANEL, use FINDWINDOWEX can further

CodePudding user response:

The GetCursorPos (OldPos);
SetCursorPos (clickX clickY);
Mouse_event (MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0).
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0, 0).

Try this several functions
  • Related