// tm.cpp : Defines the entry point for the console application. // #include "stdafx.h" # include # include # include int main(int argc, char* argv[]) { HWND hWndDesktop, hWnd ; char *sText ; int i = 0; long lState ; sText = (char*) malloc( 255 ) ; hWndDesktop = GetDesktopWindow( ) ; hWnd = GetTopWindow( hWndDesktop ) ; while ( hWnd ) { i++ ; if ( GetWindowTextA( hWnd, sText, 254 ) ) { if ((lState&0x10000000L) == 0x10000000L ) fprintf( stdout, "process [%d]\t V : %30.30s", i, sText ) ; else fprintf( stdout, "process [%d]\t : %30.30s", i, sText ) ; fprintf( stdout, "\t handle : 0X%08X\n", hWnd ) ; lState = GetWindowLong( hWnd, GWL_STYLE ) ; if ( strncmp( sText, "Mon Serveur", 11 ) == 0) { SendMessage( hWnd, 0x4000, 102, 103 ) ; break ; } } hWnd = GetWindow( hWnd, 2 ) ; } getc( stdin ) ; SendMessage( hWnd, 0x4001, 0, 0 ) ; return 0 ; }