home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / os2thred.zip / PMTHREAD.H < prev    next >
C/C++ Source or Header  |  1994-06-05  |  1KB  |  57 lines

  1. // Listing 9 -- PMThread.h
  2.  
  3. #if !defined(PMTHREAD_INC)
  4. #define PMTHREAD_INC
  5.  
  6. //----------------------------- Includes ---------------------------
  7.  
  8. #include "QThread.h"
  9.  
  10. //----------------------------- defines ----------------------------
  11.  
  12. const ULONG PMTHRD_DEF_STACKSIZE     = 8192;
  13.  
  14. //--------------------------- Public Types -------------------------
  15. // Type for the procedure that is supplied to perform initialization
  16. // and shutdown for the PM thread.  Usually this proc registers user
  17. // classes and/or creates the main window or windows.
  18.  
  19. class PMThread;        // forward declaration
  20.  
  21. typedef VOID FNPROC (BOOL start, ULONG ulArg, PMThread* pmThrd);
  22. typedef FNPROC* PFNPROC;
  23.  
  24. //------------------------------ Class -----------------------------
  25.  
  26. class PMThread : public QThread {
  27. public:
  28.     PMThread (    PFNPROC pfn,
  29.                 USHORT usQSize=0,
  30.                 ULONG ulStackSize=PMTHRD_DEF_STACKSIZE);
  31.     ~PMThread ();
  32.  
  33.     VOID Startup (ULONG ulArg);
  34.     BOOL Shutdown(ULONG ulArg);
  35.  
  36.     VOID SendMsg(    ULONG objAddr,
  37.                     ULONG msg,
  38.                     MPARAM mp1, MPARAM mp2);
  39.                 
  40.     BOOL GetMessage(QMSG & qmsg)
  41.             { return WinGetMsg(hab, &qmsg, NULLHANDLE, 0,0); }
  42.  
  43.     VOID DispatchMsg (QMSG & qmsg)
  44.             { WinDispatchMsg (hab, &qmsg); }
  45.  
  46.     HAB QueryHAB() { return hab; }
  47.     HMQ QueryHMQ() { return hmq; }
  48.  
  49. private:
  50.     HAB            hab;        // PM Anchor block handle
  51.     HMQ            hmq;        // Message Queue handle
  52.     PFNPROC        pfnProc;
  53. };
  54.  
  55. //-------------------------- End of Header -------------------------
  56. #endif
  57.