home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / MODULEOB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-24  |  1.4 KB  |  67 lines

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