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 29 30 31 32
|
BOOL CALLBACK ListWindow(HWND hWnd, LPARAM lParam){
char title[256];
char *pt=NULL;
HWND hctrl,hedit;
GetWindowText(hWnd,title,1024);
pt=strstr(title,TITRE);
if(pt!= NULL) {
printf("0x%x %s \r\n",hWnd,title);
//hctrl = FindWindow("Host &Name (or IP address)",NULL);
hctrl=FindWindowEx(hWnd,NULL,NULL,"Host &Name (or IP address)");
if(hctrl){
printf("0x%x\r\n",hctrl);
SetForegroundWindow(hctrl);
Sleep(100);
PostMessage(hctrl,WM_KEYDOWN,VK_NUMPAD0,NULL);
Sleep(100);
PostMessage(hctrl,WM_KEYUP,VK_NUMPAD0,NULL);
Sleep(100);
}
}
return TRUE;
}
int main(int argc, char * argv[])
{
EnumWindows(ListWindow,NULL); /* Recherche du handle de Putty*/
return EXIT_SUCCESS;
} |
Partager