In many cases, we need to implement such functions in the program: Control a button in another software in the self-written program is pressed. For example, one day you are talking
I feel annoyed, then I want to write the program to help you press the "Send" button and save yourself once again. So, how can this idea be realized?
In fact, it is very simple, it can only be implemented with two Windows messages. (Of course, the premise is that you have to know the Handle of that button. I think this is a small dish. Below I give a simple instance description usage:
Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);
VAR
btnhandle: hwnd; // The handle of the button to be controlled
Begin
btnhandle: = start (edit1.text); // is settled in order to make it, you have to write programs to get it.
SendMessage (btnHandle, WM_LButtondown, MK_LButton, 0);
SendMessage (btnhandle, WM_LButtonUp, 0, 0);
END;
The whole process is actually simulated that the left mouse button is pressed and released (note that the left mouse button is pressed). how about it? Simple enough! Now you can add this feature into your program, implement some interesting effect! :)