home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / S12205.ZIP / KILL.C
C/C++ Source or Header  |  1989-02-02  |  1KB  |  46 lines

  1. /*
  2.  *  This program provides the command line ability to kill another process.
  3.  *  The other process does not need to be a child of this process.  The
  4.  *  other process may be active in a screen group or detached.
  5.  *
  6.  *  This program demonstrates the use of:
  7.  *    DosKillProcess
  8.  *
  9.  *  Compile and Link instructions:
  10.  *
  11.  *    cl -c -Zi -Od kill.c
  12.  *    link kill/CO;
  13.  *
  14.  *  Execution insturctions:
  15.  *
  16.  *    kill <process ID number> (press return key)
  17.  *
  18.  *  This software is provided for demonstration purposes only.
  19.  *  Microsoft makes no warranty, either express or implied as
  20.  *  to its usability in any given situation.
  21. */
  22.  
  23. #define INCL_BASE
  24. #include <os2.h>
  25. #include <stdio.h>
  26.  
  27. main(argc, argv)
  28. unsigned short argc;
  29. char **argv;
  30. {
  31.  
  32.   int rc;
  33.                     /* make sure a process ID supplied   */
  34.   if (argc > 1) {
  35.  
  36.     rc = DosKillProcess(DKP_PROCESSTREE,
  37.             atoi(argv[1]));
  38.     if (rc) {
  39.       printf("ERROR - DosKillProcess, rc == %d\n", rc);
  40.     }
  41.   }
  42.   else {
  43.     printf("KILL <process ID number> (press return key)\n");
  44.   }
  45. }
  46.