1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
HWND scan_hwnd_scanned =null;
bool scan_hwnd_found =false;
bool CALLBACK scanwindowsproc (HWND hwnd, LPARAM lparam)
{
char _class[256+1],_title[256+1],buffer[256+1];
::GetWindowText (hwnd,_title,256); cout<<"\n\nTitle ["<<_title<<"]";dows
::GetClassName (hwnd,_class,256); cout<<" Class ["<<_class<<"]";
if (strstr(_title,(char*)lparam))
{
printf ("**** hwnd[%s] found [%u][%s][%s]\n",(char*)lparam,hwnd,_title,_class);
scan_hwnd_found=true;
scan_hwnd_scanned=hwnd;
return false; // window found, so we break research
}
return true;
}
bool ScanWindows (char *name, HWND &hwnd)
{
scan_hwnd_found=false;
scan_hwnd_scanned =null;
EnumWindows ((WNDENUMPROC)scanwindowsproc,(LPARAM)name);
if (scan_monitor_found) hwnd=scan_hwnd_scanned;
return scan_monitor_found;
} |
Partager