How to control window controls on other program forms:

xiaoxiao2021-03-06  78

I am really sorry, I wrote it, after the middle, I didn't complete the most critical work because I have been busy with the project. Many netizens have sent me an email question. At the same time, I felt very sad at some people. I booked a lot of shallow ignorance, very Luoli, and put my experience to everyone. I don't have benefits, but also waste time. How did you publish something? So I have never wanted to continue writing. Now look at me, it is really fine enough. In fact, a few words will be done, but I don't understand what the callback, so I have been a long time. To get the control handle on other programs, first give a hypothesis: other programs' UI will not change, for example, we open QQ, so as long as we do not upgrade, open QQ in the morning, open QQ in the afternoon, the menu, Pressing the category of the New button not suddenly or suddenly. I don't apply if there is any change. Get the control handle on other programs, simply, the basic process is like this. First run the window program you want to control. Then get the handle of the main window, which has been fixed. Then there is a main window handle to get all the control handles on the window, which has been set. With the foundation of the two steps, we can write a helper before formal writing programs to control other program window controls, use this tool to help us to determine the control handle we want to control. As follows: The function EnumChildWindows (hWndParent: HWND; lpEnumFunc: TFNWndEnumProc; lParam: LPARAM): BOOL; stdcall; function EnumChildWndProc (AhWnd: LongInt; AlParam: lParam): boolean; stdcall; in EnumChildWndProc we get all the handle of the control window, Each time you get a handle, we send a setWindowText message to this control, write a serial number, starting from 0, has been writing. and then? Let's take a look at the window of the program we want to control, is the text on the control becomes a number? For those who cannot display text, we use other methods, as long as you can find the serial number of the control in this process. Now we know the serial number when the control needs to be controlled in the original window. I know what to do now? Yes, now formally write the control program. Similarly, we are in Function EnumchildWndProc (AhWnd: longint; alparam: lparam): boolean; stdcall; uses a counter to get the current handle serial number, compared with the handle serial number required to control, the control handle of the control will be determined. Others will do it.

转载请注明原文地址:https://www.9cbs.com/read-94016.html

New Post(0)