Retrive the class names of all windows[MSDN]

Below search method will be useful when you need to find a window with no caption.
FindWindow will not work correctly in such a instance.
You can make use of the below method to do that.
//get the handle to the top window
HWND h = ::GetTopWindow(0);
while ( h)
TCHAR    buf[100];
::GetClassName( h, (LPTSTR)&buf, 100 );
if ( _tcscmp( buf, _T(“Youclassnametosearch”) ) == 0 )
return true;
//get the handle to the next window
h = ::GetNextWindow( h , GW_HWNDNEXT);
return false;

Leave a Reply

Your email address will not be published. Required fields are marked *