home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 038 / dho_9a.zip / NMDLOG.CC < prev    next >
Text File  |  1994-10-13  |  3KB  |  117 lines

  1. // Developer Helper Object Set, (C) 1994 Thomas E. Bednarz, Jr.
  2. //  All rights reserved
  3.  
  4.  
  5. #include"nmdlog.h"
  6.  
  7. TNonModalDialog *tempTHIS = NULL;
  8.  
  9.  
  10. //-------------------------------------------------------------------
  11. //  TNonModalDialog
  12. TNonModalDialog::TNonModalDialog(ULONG resource):
  13.       TWinBase(resource)
  14. {
  15.    tempTHIS = this;
  16. }
  17.  
  18.  
  19. //-------------------------------------------------------------------
  20. //  ~TNonModalDialog
  21. TNonModalDialog::~TNonModalDialog()
  22. {
  23.  
  24. }
  25.  
  26.  
  27. //-------------------------------------------------------------------
  28. //  Init
  29. BOOL TNonModalDialog::Init(HAB hab)
  30. {
  31.    SWP swp;
  32.  
  33.    MakeFrame();
  34.  
  35.    WinQueryTaskSizePos(hab, 0, &swp);
  36.  
  37.    WinSetWindowPos(hwndFrame,(ULONG)NULL, swp.x,
  38.             swp.y, 0,0,SWP_SHOW | SWP_MOVE);
  39.  
  40.  
  41. }
  42.  
  43.  
  44. //-------------------------------------------------------------------
  45. //  getClassName
  46. const char *TNonModalDialog::getClassName(void)
  47. {
  48.    return "TNonModalDialog";
  49. }
  50.  
  51.  
  52. //-------------------------------------------------------------------
  53. //  MakeFrame
  54. BOOL TNonModalDialog::MakeFrame(void)
  55. {
  56.    hwndFrame = WinLoadDlg( HWND_DESKTOP,
  57.                              HWND_DESKTOP,
  58.                               (PFNWP)ClientDlogProc,
  59.                              0,fResource,NULL);
  60.  
  61.    return (hwndFrame != (HWND)NULL);
  62.  
  63. }
  64.  
  65.  
  66. //-------------------------------------------------------------------
  67. //  doCommand
  68. MRESULT TNonModalDialog::doCommand(HWND hWnd, ULONG Message, MPARAM mParam1, MPARAM mParam2)
  69. {
  70.    return WinDefDlgProc(hWnd, Message,mParam1, mParam2);
  71. }
  72.  
  73.  
  74. //-------------------------------------------------------------------
  75. //  DlogProc
  76. MRESULT TNonModalDialog::DlogProc(HWND hWnd, ULONG Message, MPARAM mParam1, MPARAM mParam2 )
  77. {
  78.    switch (Message)
  79.    {
  80.        case WM_CLOSE:
  81.           WinPostMsg(hWnd, WM_QUIT, 0,0);
  82.           return FALSE;
  83.        case WM_COMMAND:
  84.             return doCommand(hWnd, Message, mParam1, mParam2);
  85.          break;
  86.         default:
  87.            return WinDefDlgProc(hWnd, Message,mParam1, mParam2);
  88.            break;
  89.    }
  90.    return (MRESULT)FALSE;
  91. }
  92.  
  93.  
  94. //-------------------------------------------------------------------
  95. //  ClientDlogProc
  96. MRESULT EXPENTRY TNonModalDialog::ClientDlogProc(HWND hWnd,ULONG iMessage,
  97.        MPARAM mParam1, MPARAM mParam2)
  98. {
  99.  
  100.     TNonModalDialog *pDialog = (TNonModalDialog *)WinQueryWindowULong(hWnd,0);
  101.  
  102.     if (pDialog == 0)
  103.     {
  104.         if (iMessage == WM_INITDLG)
  105.         {
  106.             pDialog = tempTHIS;
  107.             WinSetWindowULong(hWnd,0,(ULONG)pDialog);
  108.             return pDialog->DlogProc(hWnd,iMessage,mParam1,mParam2);
  109.         }
  110.         else
  111.             return WinDefDlgProc(hWnd,iMessage,mParam1,mParam2);
  112.     }
  113.     else
  114.         return pDialog->DlogProc(hWnd,iMessage,mParam1,mParam2);
  115. }
  116.  
  117.