|
// GetTargetAppWindow.cpp
static TCHAR g_szTargetWndClass[] = _T("Notepad");
static HWND g_hWnd = 0;
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
TCHAR szClassName[_MAX_PATH];
memset( szClassName, 0, sizeof(szClassName) );
GetClassName( hWnd, szClassName, sizeof(szClassName) );
if ( !_tcscmp((LPCTSTR)lParam, szClassName) )
{
g_hWnd = hWnd;
return FALSE;
}
return TRUE;
}
HWND WaitForWndOfClass(LPCTSTR szWndClassName)
{
WORD wCounter = 0;
while( EnumWindows(EnumWindowsProc, (LPARAM)szWndClassName) &&
10 > wCounter )
{
Sleep( 20 );
++wCounter;
}
return g_hWnd;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.