简单的调用例子, 适合初学者学习,当然 我也是初学者.
1 #include <windows.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 #define dim(x) (sizeof()/sizeof(x[0])) 6 7 int main() 8 { 9 system("color 5b"); 10 /* system("mode con cols=60 lines=8");*/ 11 system("title Kill Window"); 12 char sName[80] = {0}; 13 HWND hWnd = 0; 14 15 puts("====--------------===="); 16 puts("==== QQ 702368956 ===="); 17 puts("====--------------===="); 18 while (1) 19 { 20 printf("Help You Kill it: "); 21 gets(sName); 22 hWnd = FindWindow(NULL, sName); 23 if (hWnd) 24 { 25 SendMessage(hWnd, WM_CLOSE, 0, 0); 26 break; 27 } 28 else 29 { 30 printf(" 没有找到窗口... "); 31 continue; 32 } 33 } 34 return 0; 35 }