home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / DOSCALLS.LIB < prev    next >
Text File  |  1994-03-08  |  4KB  |  97 lines

  1. /*******************************************************************************
  2.  *** DosCalls.lib - This library contains wrappers functions and definitions ***
  3.  *** ver.1          used in making calls into the DosCalls dll.  This        ***
  4.  ***                file may be #include'ed into your source file, or you    ***
  5.  ***                may want to improve speed and memory use by copying just ***
  6.  ***                the relevant sections into your source code.             ***
  7.  *******************************************************************************/
  8.  
  9. #define  NO_ERROR          0     // return code from most successful DosCalls
  10.  
  11.  
  12. DosSetDefaultDisk(DriveNumber) // set new drive number; 1=A, 2=B, etc...
  13. {
  14.    #define ORD_DOS32SETDEFAULTDISK  220
  15.    return DynamicLink("doscalls",ORD_DOS32SETDEFAULTDISK,BIT32,CDECL,DriveNumber)
  16. }
  17.  
  18. DosSleep(MilliSeconds)  // suspend process for the specified milliseconds
  19. {
  20.    #define ORD_DOS32SLEEP  229
  21.    return DynamicLink("doscalls",ORD_DOS32SLEEP,BIT32,CDECL,MilliSeconds)
  22. }
  23.  
  24. DosGetDateTime(DateTime)  // set up the DateTime blob containing the OS/2 DateTime structure
  25. {
  26.    #define ORD_DOS32GETDATETIME  230
  27.    #define SIZEOF_DATETIME       12
  28.    undefine(DateTime)
  29.    BLObPut(DateTime,SIZEOF_DATETIME-1,0,UWORD8); // create SIZEOF_DATETIME blob
  30.    return DynamicLink("doscalls",ORD_DOS32GETDATETIME,BIT32,CDECL,DateTime)
  31. }
  32.  
  33. DosKillProcess(ActionCode,ProcessID)
  34.    // kill specified ProcessID using action code DKP_PRECESSTREE or DKP_PROCESS
  35. {
  36.    #define DKP_PROCESSTREE    0  // kill process and all descendents, if created by this process
  37.    #define DKP_PROCESS        1  // kill any process even if not created by this process
  38.    #define ORD_DOS32KILLPROCESS  235
  39.    return DynamicLink("doscalls",ORD_DOS32KILLPROCESS,BIT32,CDECL,ActionCode,ProcessID)
  40. }
  41.  
  42. DosSetPriority(Scope,PriorityClass,PriorityDelta,id)
  43.    // alter the priority of a specified process and/or thread(s)
  44. {
  45.    // Scope - The extent of the priority change:
  46.       #define PRTYS_PROCESS      0  // All the threads of any process.
  47.       #define PRTYS_PROCESSTREE  1  // All the threads of a process and any descendants. The indicated process must be
  48.                                     // the current process or a process created by the current process. Detached processes may not be
  49.                                     // specified. The indicated process may possibly have terminated.
  50.       #define PRTYS_THREAD       2  // A single thread of the current process.
  51.    // PriorityClass - Priority class of a process:
  52.       #define PRTYC_NOCHANGE           0  // No change, leave as is
  53.       #define PRTYC_IDLETIME           1  // Idle-time
  54.       #define PRTYC_REGULAR            2  // Regular
  55.       #define PRTYC_TIMECRITICAL       3  // Time-critical
  56.       #define PRTYC_FOREGROUNDSERVER   4  // Server
  57.    // PriorityDelta - Change to apply to the current base priority level of the process.
  58.    // This value must range between:
  59.       #define PRTYD_MINIMUM   -31
  60.       #define PRTYD_MAXIMUM   +31
  61.    // id - process or thread identifier.  If zero then current process or thread
  62.    // assuming all input values are valid, call the system function
  63.    #define ORD_DOS32SETPRIORITY  236
  64.    return DynamicLink("doscalls",ORD_DOS32SETPRIORITY,BIT32,CDECL,
  65.                       Scope,PriorityClass,PriorityDelta,id)
  66. }
  67.  
  68. DosSetCurrentDir(DirName)  // change current directory to DirName
  69. {
  70.    #define ORD_DOS32SETCURRENTDIR   255
  71.    return DynamicLink("doscalls",ORD_DOS32SETCURRENTDIR,BIT32,CDECL,DirName)
  72. }
  73.  
  74. DosBeep(Frequency,Duration)   // play specified Frequency, in Hz, for specified
  75. {                             // duration, in milliseconds
  76.    #define ORD_DOS32BEEP   286
  77.    return DynamicLink("doscalls",ORD_DOS32BEEP,BIT32,CDECL,Frequency,Duration)
  78. }
  79.  
  80. DosGetInfoBlocks(ThreadInfoBlock,ProcessInfoBlock)
  81.    // set ThreadInfoBlock and ProcessInfoBlock to point to their respective
  82.    // structures in memory.  If you know these structures, then you can use
  83.    // peek() calls to get the values.
  84. {
  85.    undefine(ThreadInfoBlock), undefine(ProcessInfoBlock);
  86.    #define ORD_DOS32GETINFOBLOCKS   312
  87.    return DynamicLink("doscalls",ORD_DOS32GETINFOBLOCKS,BIT32,CDECL,
  88.                       ThreadInfoBlock,ProcessInfoBlock)
  89. }
  90.  
  91. DosShutdown()
  92. {
  93.    #define ORD_DOS32SHUTDOWN  415
  94.    return DynamicLink("doscalls",ORD_DOS32SHUTDOWN,BIT32,CDECL,0)
  95. }
  96.  
  97.