Window hiding Tool

Source: Internet
Author: User

In Windows, sometimes some windows must be open all the time, but if there are more windows, you may be upset. Fortunately, there is a hidden window method in Windows API. In order to learn the MFC programming, I wrote a tool to hide the window.

 

The main APIs used in the tool are as follows:

Enumwindows: enumwindows (enumwindowsproc, 0). This function is used to traverse all windows. enumwindowsproc is a callback function, as shown below:

Code <! --

Code highlighting produced by actipro codehighlighter (freeware)
Http://www.CodeHighlighter.com/

--> Bool callback enumwindowsproc (hwnd, lparam)
{
// Afxmessagebox (_ T ("hello ")
Long gwl_style = Getwindowlong (hwnd, gwl_style );
If (Gwl_style & Ws_caption ))
{
If (Hwnd ! = Thishwnd)
{
Tchar title [ 255 ];
: Getwindowtext (hwnd, title, 255 );
If (Wcscmp (L "" , Title) ! =   0 )
{
If (Iswindowvisible (hwnd ))
{
Visiblewindows. push_back (hwnd );
}
Else
{
If (Isw.wenabled (hwnd ))
{
Hidewindows. push_back (hwnd );
}
}
}
}
}
Return True;
}

List all visible and invisible windows.

 

Findwindow: hwnd =: findwindow (0, title). You can find the handle of the window through the title of the window.

 

Showwindow: Hide or display a window. showwindow (hwnd, sw_hide), showwindow (hwnd, sw_show)

 

There are so many things that are basically used.Code, Click here to download.

 

 

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.