home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / switchto.zip / SwitchTo.hpp < prev    next >
Text File  |  1998-04-01  |  4KB  |  96 lines

  1. /***********************************************************************\
  2.  *                            SwitchTo.cpp                             *
  3.  *                 Copyright (C) by Stangl Roman, 1998                 *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed, under the conditions indicated in the documentation.       *
  6.  *                                                                     *
  7.  * SwitchTo.hpp SwitchTo/2 header file.                                *
  8.  *                                                                     *
  9. \***********************************************************************/
  10.  
  11. #define     INCL_DOSMISC
  12. #define     INCL_DOSERRORS
  13. #define     INCL_DOSPROCESS
  14. #define     INCL_DOSSESMGR
  15. #define     INCL_DOSQUEUES
  16. #define     INCL_DOSMODULEMGR
  17. #define     INCL_WINPROGRAMLIST
  18. #define     INCL_WINWINDOWMGR
  19. #define     INCL_WINDIALOGS
  20. #define     INCL_WINERRORS
  21. #define     INCL_SHLERRORS
  22. #define     INCL_WINSWITCHLIST
  23. #include    <os2.h>
  24.  
  25. #define NLSMSG_COPYRIGHT1               1
  26. #define NLSMSG_COPYRIGHT2               2
  27. #define NLSMSG_USAGE1                   3
  28. #define NLSMSG_USAGE2                   4
  29. #define NLSMSG_USAGE3                   5
  30. #define NLSMSG_INVOKE1                  6
  31. #define NLSMSG_INVOKE2                  7
  32. #define NLSMSG_INVOKE3                  8
  33. #define NLSMSG_INVOKE4                  9
  34. #define NLSMSG_INVOKE5                  10
  35.  
  36. #define ERR_NOERROR                     0
  37. #define ERR_SYNTAX                      1
  38. #define ERR_SWITCHFAILED                2
  39. #define ERR_READINGQUEUE                3
  40.  
  41.                                         /* STDOUT file handle is numerically 1 for all
  42.                                            OS/2 processes */
  43. #define STDOUT                          0x00000001
  44.  
  45. #define SWITCHTO_QUEUE                  "\\QUEUES\\SWITCHTO\\SELFPM.QUE"
  46.  
  47.                                         /* RESULTCODES is already defined in BASEDEF.H
  48.                                            (used only for VDM support) and BSEDOS.H, but
  49.                                            in the later header with ULONG members not
  50.                                            USHORT which the Session Manager will return
  51.                                            in the queue when the started session terminates */                    
  52. typedef struct RESULTCODE
  53. {
  54.     USHORT              usCodeTerminate;
  55.     USHORT              usCodeResult;
  56. };
  57.  
  58. /****************************************************************************************\
  59.  * Class: SwitchTo                                                                      *
  60. \****************************************************************************************/
  61. class   SwitchTo
  62. {
  63. public:
  64.                         SwitchTo(int argc, char *argv[]);
  65. protected:
  66.     SwitchTo           &checkEnvironment(void);
  67. #ifdef  CHANGETYPE
  68.     SwitchTo           &setProcessType(ULONG ulProcessType);
  69. #endif  /* CHANGETYPE */
  70.     SwitchTo           &displayMessage(int iMessage, char *pcParameter=0);
  71. #ifdef  LAUNCHCOPY
  72.     SwitchTo           &relaunchSelf(void);
  73. #endif  /* LAUNCHCOPY */
  74.     ULONG               switchtoApplication(void);
  75.  
  76. public:
  77.     int                 iResult;
  78. protected:
  79.     ULONG               ulProcessType;
  80.     char               *pcSessionName;
  81.     char                acPathExecutable[CCHMAXPATH];
  82.     char                acPathMessage[CCHMAXPATH];
  83.  
  84.     HAB                 hab;
  85.     HMQ                 hmq;
  86.                                         /* At the moment we don't use all of that, but ... */
  87.     HWND                hwndFrame;
  88.     HWND                hwndClient;
  89. };
  90.  
  91. extern "C"
  92. {
  93.     long time(long *ptimer);
  94. }
  95.  
  96.