BOOL CALLBACK EnumChildProc(HWND hwnd,_In_ LPARAM lParam){
char szTitle[MAX_PATH]= {0};
char szClass[MAX_PATH]= {0};
int nMaxCount = MAX_PATH;
LPSTR lpclassName = szClass;
LPSTR lpwindowName = szTitle;
GetWindowTextA(hwnd,lpwindowName,nMaxCount);
GetClassNameA( hwnd,lpclassName,nMaxCount);
cout <<"[child window] window handle: " << hwnd << " window name: "
<<lpwindowName << " class name " <<lpclassName << endl;
return TRUE;
}
BOOL CALLBACK EnumlindowsProc(HWND hwnd,LPARAM lParam){
char szTitle[MAX_PATH] ={0};
char szClass[MAX_PATH] = {0};
int nMaxCount = MAX_PATH;
LPSTR lpClassName = szClass;
LPSTR lpwindowName = szTitle;
GetWindowTextA(hwnd,lpwindowName,nMaxCount);
GetClassNameA(hwnd,lpClassName,nMaxCount);
if(strcmp(lpClassName,"IME")!=0){
cout <<"[Parent window] window handle: " << hwnd <<lpwindowName<< " class name " << lpClassName << endl;
//EnumChildProc(hwnd,0);
}
if(strcmp(lpClassName,"TXGuiFoundation")==0){
// ::ShowWindow(hwnd,SW_SHOWNORMAL);
// ::SetForegroundWindow(hwnd);
}
return TRUE;
}
int main(int argc, char *argv[])
{
// SetUnhandledExceptionFilter(callback);
SingleApplication a(argc, argv);
if(a.isRunning()){
return 0;
}
EnumWindows(&EnumlindowsProc,0);
}