home *** CD-ROM | disk | FTP | other *** search
- /*
- KILL.C -- terminate Windows task
-
- This is not a WINIO utility (it doesn't need a window or any output)
- Build with Borland C++: bcc -WS kill.c
-
- From "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
- */
-
- #include <stdlib.h>
- #include <stdio.h>
- #include "windows.h"
- #include "toolhelp.h"
-
- #define argc _argc
- #define argv _argv
- extern int _argc;
- extern char **_argv;
-
- extern int main(int argc, char **argv);
-
- int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
- {
- return main(argc, argv);
- }
-
- main(int argc, char *argv[])
- {
- if (argc < 2)
- MessageBox(NULL, "usage: kill [task]", "KILL", MB_OK);
- else
- {
- WORD hTask;
- sscanf(argv[1], "%04x", &hTask);
- if (hTask)
- TerminateApp(hTask, NO_UAE_BOX);
- }
- return 0;
- }
-