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.