home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OWLSRC.PAK / MODULEOB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.6 KB  |  89 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1991, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Implementation of obsolete functions in class TModule.
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_APPLICAT_H)
  11. # include <owl/applicat.h>
  12. #endif
  13. #if !defined(OWL_DIALOG_H)
  14. # include <owl/dialog.h>
  15. #endif
  16. #if !defined(OWL_MDI_H)
  17. # include <owl/mdi.h>
  18. #endif
  19.  
  20. OWL_DIAGINFO;
  21.  
  22. //
  23. //
  24. //
  25. TWindow*
  26. TModule::MakeWindow(TWindow* win)
  27. {
  28.   if (win->Create())
  29.     return win;
  30.  
  31.   win->Destroy();
  32.   delete win;
  33.   return 0;
  34. }
  35.  
  36. //
  37. //
  38. //
  39. int
  40. TModule::ExecDialog(TDialog* dialog)
  41. {
  42.   int ret = dialog->Execute();
  43.   delete dialog;
  44.   return ret;
  45. }
  46.  
  47. //
  48. //
  49. //
  50. HWND
  51. TModule::GetClientHandle(HWND hWnd)
  52. {
  53.   if (hWnd) {
  54.     HWND  curWindow = GetWindow(hWnd, GW_CHILD);
  55.  
  56.     if (curWindow) {
  57.       do {
  58.         char  className[10];
  59.  
  60.         ::GetClassName(curWindow, className, sizeof(className));
  61.  
  62.         if (strnicmp(className, "MDICLIENT", sizeof(className)) == 0)
  63.           return curWindow;
  64.  
  65.       } while ((curWindow = GetWindow(curWindow, GW_HWNDNEXT)) != 0);
  66.     }
  67.   }
  68.  
  69.   return 0;
  70. }
  71.  
  72. //
  73. //
  74. //
  75. TWindow*
  76. TModule::GetParentObject(HWND hWndParent)
  77. {
  78.   TWindow*  window = GetWindowPtr(hWndParent);
  79.   HWND      clientHandle;
  80.  
  81.   if (window)
  82.     return window;
  83.  
  84.   if ((clientHandle = GetClientHandle(hWndParent)) != 0)
  85.     return new TMDIFrame(hWndParent, clientHandle);
  86.  
  87.   return new TWindow(hWndParent);
  88. }
  89.