ENUMCHILDWINDOWS power

zhaozj2021-02-16  52

Copyright Notice: You can reprint anything, please be sure to indicate the original source of the article by hyperlink http://xinyistudio.vicp.net/ and author information and this statement

I have written something similar to SPY and check the password window, I have always wanted to give this little thing.

Some times have been interested in software installation registration, some software If you don't enter the correct registration code, the dead "next" button has been disable. This time, I let Spy complete Spy, set the button used to the button, let me easily enter "Next", huh, huh ...

My thoughts are that the cursor moves to the specified window, detect how much button on this window, if there is, will enable them.

Here I don't want to discuss how to implement this feature, but you have to know that you want to get these handles of these DISABLE windows (buttons) are simply could not pass through the WindowFromPoint this API function. GetWindow should not think.

I checked the MSDN, seeing EnumChildWindows, you can enumerate all the sub-windows of a parent window:

Bool EnumChildWindows (HWND HWNDPARENT, // Handle to Parent Window // Parent Window Handle WNDenumProc LpenumFunc, // Callback Function // Tonance Function Address LParam LParam // Application-Defined Value // You have defined parameters);

It's so simple, let's define a callback function, like this:

Bool Callback EnumchildProc (hwnd hwnd, // handle to child window lparam lparam // Application-defined value);

Note: This callback function is either a static function of a class or is a global function.

--------------------------------

When calling the enumchildwindows function until the one is called to the most sub-window, it will be enumerated.

With the top knowledge, I think you should know how to do it.

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

New Post(0)