home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l430 / 1.ddi / CHAP5.ZIP / KILL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-08  |  896 b   |  42 lines

  1. /* 
  2. KILL.C -- terminate Windows task
  3.  
  4. This is not a WINIO utility (it doesn't need a window or any output)
  5. Build with Borland C++:  bcc -WS kill.c
  6.  
  7. From "Undocumented Windows" (Addison-Wesley 1992)
  8. by Andrew Schulman, Dave Maxey and Matt Pietrek
  9. */
  10.  
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include "windows.h"
  14. #include "toolhelp.h"
  15.  
  16. #define argc _argc
  17. #define argv _argv
  18. extern int _argc;
  19. extern char **_argv;
  20.  
  21. extern int main(int argc, char **argv);
  22.  
  23. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, 
  24.     LPSTR lpCmdLine, int nCmdShow)
  25. {
  26.     return main(argc, argv);
  27. }
  28.  
  29. main(int argc, char *argv[])
  30. {
  31.     if (argc < 2)
  32.         MessageBox(NULL, "usage: kill [task]", "KILL", MB_OK);
  33.     else
  34.     {
  35.         WORD hTask;
  36.         sscanf(argv[1], "%04x", &hTask);
  37.         if (hTask)
  38.             TerminateApp(hTask, NO_UAE_BOX);
  39.     }
  40.     return 0;
  41. }
  42.