struct EnumWindowsParam {
DWORD dwPID;
HWND hFoundWnd;
};
BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM l)
{
EnumWindowsParam* pParam = ( EnumWindowsParam*)l;
DWORD dwPID = 0;
::GetWindowThreadProcessId( hWnd, &dwPID);
if( pParam->dwPID == dwPID)
{
std::vector< char > vClass( 128, 0);
if( ::GetClassName( hWnd, &vClass[ 0], (int)vClass.size()) && !stricmp( &vClass[ 0], "TTOTAL_CMD"))
{
pParam->hFoundWnd = hWnd;
return FALSE;
}
}
return TRUE;
}
...
...
EnumWindowsParam param = { GetCurrentProcessId(), NULL };
::EnumWindows( EnumWindowsProc, LPARAM( ¶m));
if( ::IsWindow( param.hFoundWnd))
{
...
}
|