Skip to main content

Posts

Showing posts with the label find window

C Windows API - Enumerate Windows and some manipulation

Few years back I wrote a program in C language using Windows API that displays the list of all "Windows" opened on my PC (Windows) and I can make any of them visible/invisible. I decided to share the part of code which Enumerate windows, find a window and make them visible/invisible. Enumerating Windows Windows API provide a function EnumWindows  which takes a pointer to Callback function which it calls for each window found. Second parameter is a LPARAM which you can use to pass any argument you want, this LPARAM will be passed to our callback function. Here is how to use EnumWindows BOOL isSuccess=EnumWindows(OurAppCallback,(LPARAM)userDefinedVariable); Syntax of callback (OurAppCallback) will be like this BOOL CALLBACK OurAppCallback(HWND h,LPARAM l)  Important Remarks about EnumWindows from MSDN:  The EnumWindows function does not enumerate child windows, with the exception of a few top-level windows owned by the system that have the WS_CHILD style....