home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 11.ddi / OWLSRC.PAK / MODULEOB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  1.4 KB  |  66 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   source\owl\moduleob.cpp
  4. //   Implementation of obsolete functions in class TModule.
  5. //----------------------------------------------------------------------------
  6. #include <owl\owlpch.h>
  7. #include <owl\applicat.h>
  8. #include <owl\dialog.h>
  9. #include <owl\mdi.h>
  10.  
  11. TWindow*
  12. TModule::MakeWindow(TWindow* win)
  13. {
  14.   if (win->Create())
  15.     return win;
  16.  
  17.   win->Destroy();
  18.   delete win;
  19.   return 0;
  20. }
  21.  
  22. int
  23. TModule::ExecDialog(TDialog* dialog)
  24. {
  25.   int ret = dialog->Execute();
  26.   delete dialog;
  27.   return ret;
  28. }
  29.  
  30. HWND
  31. TModule::GetClientHandle(HWND hWnd)
  32. {
  33.   if (hWnd) {
  34.     HWND  curWindow = GetWindow(hWnd, GW_CHILD);
  35.  
  36.     if (curWindow) {
  37.       do {
  38.         char  className[10];
  39.  
  40.         GetClassName(curWindow, className, sizeof(className));
  41.  
  42.         if (strnicmp(className, "MDICLIENT", sizeof(className)) == 0)
  43.           return curWindow;
  44.  
  45.       } while ((curWindow = GetWindow(curWindow, GW_HWNDNEXT)) != 0);
  46.     }
  47.   }
  48.  
  49.   return 0;
  50. }
  51.  
  52. TWindow*
  53. TModule::GetParentObject(HWND hWndParent)
  54. {
  55.   TWindow*  window = GetWindowPtr(hWndParent);
  56.   HWND      clientHandle;
  57.  
  58.   if (window)
  59.     return window;
  60.  
  61.   if ((clientHandle = GetClientHandle(hWndParent)) != 0)
  62.     return new TMDIFrame(hWndParent, clientHandle);
  63.  
  64.   return new TWindow(hWndParent);
  65. }
  66.