The principle of Windows key breakthrough expert

Source: Internet
Author: User
Tags bool

Believe that in the Window button breakthrough experts did not come out, many people do not know that the software can also be made, I am the same, when you know that there is a window button breakthrough expert software, carefully to think about the principle of its implementation, it suddenly dawned, the original principle incredibly is so simple, Why didn't I think of it before?

OK, don't say so much nonsense, directly into the subject, I first said the key to break the principle of breakthrough. The key to achieve the breakthrough is actually enablewindow this function.

BOOL EnableWindow(
HWND hWnd,
BOOL bEnable
);

HWND Specifies the handle of the window that will be enabled or disabled;

benable enable the window if true, or false to disable the window;

If you set the second argument of EnableWindow to True, the first parameter fills the handle of the control and then changes the previously blocked control back to available.

The main question now is how to get the handle of the control, with VC + + friends, should have used Spy + + this powerful tool, it can get any control of the handle, and the window of the class name, after reading this article, readers can also do their own one of their own Spy + +.

Let's introduce the Realchildwindowfrompoint function. The function is used to get the handle of a child window at a specified point:

HWND RealChildWindowFromPoint(
HWND hwndParent, // 父窗口的句柄
POINT ptParentClientCoords // 以客户坐标指定的点
)

return value:

Returns its child window handle

The Realchildwindowfrompoint function can only find a child window that is obtained by ptparentclientcoords, but it cannot get the deepest window, which means that if there are two windows overlapping, you cannot see the window below, which is often the case.

The window of the first child window overlaps the checkbox window of the deepest window, and if you use realchildwindowfrompoint you can only get the window of the first child window and not the check box for the deepest window. So simply calling this function is not capable of implementing Spy + +.

Let's take a look at this function, which assigns the window handle of the mouse position to *phwnd. The next time you want to implement the function of Spy + +, you can call this function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.