home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 7.ddi / OWLDEMOS.ZIP / CDLGDLL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.4 KB  |  47 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <owl.h>
  4. #include "colordlg.h"
  5. #include "cdlgdll.h"
  6.  
  7. PTModule TheModule;
  8.  
  9. BOOL far _export GetColor(HWND ParentHandle, COLORREF _FAR & ColorBuffer)
  10. {
  11.   PTWindowsObject AParentAlias;
  12.   TColorDialog *TheColorDialog;
  13.  
  14.   AParentAlias = TheModule->GetParentObject(ParentHandle);
  15.   TheColorDialog= new TColorDialog (AParentAlias, ColorBuffer);
  16.   return (TheModule->ExecDialog(TheColorDialog) == IDOK);
  17. }
  18.  
  19. int FAR PASCAL LibMain(HINSTANCE hInstance, WORD /*wDataSeg*/,
  20.   WORD /* cbHeapSize */, LPSTR lpCmdLine)
  21. {
  22.   int TheStatus;
  23.  
  24.   // Note that we can't ensure that TheModule is allocated
  25.   // in memory owned by CDLGDLL.DLL.  Hence, it will get owned
  26.   // by the first application that caused CDLGDLL.DLL to be
  27.   // loaded.
  28.   TheModule = new TModule("CDLGDLL", hInstance, lpCmdLine);
  29.   TheStatus = TheModule->Status;
  30.   if ( TheStatus != 0 )
  31.   {
  32.     delete TheModule;
  33.     TheModule = NULL;
  34.   }
  35.   return (TheStatus == 0);
  36. }
  37.  
  38. int FAR PASCAL WEP ( int /*bSystemExit*/ )
  39. {
  40.     // don't delete TheModule here.  We haven't guaranteed that
  41.     // TheModule points to memory owned by CDLGDLL.DLL.  It
  42.     // will belong to the application that first caused CDLGDLL.DLL
  43.     // to be loaded.  At the time WEP is called, that application,
  44.     // and all of its memory, has been deleted.
  45.     return 1;
  46. }
  47.