home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL1.ZIP / OWLDEMOS.ZIP / DLLHELLO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  1.2 KB  |  45 lines

  1. // ObjectWindows - (C) Copyright 1991 by Borland International
  2.  
  3. #include <stdlib.h>
  4. #include <owl.h>
  5. #include "windows.h"
  6. #include "dllhello.h"
  7.  
  8. PTModule DLLHelloLib;
  9.  
  10. BOOL far _export CreateDLLWindow(HWND ParentHWnd)
  11. {
  12.   PTWindowsObject AParentAlias;
  13.   PTWindow TheWindow;
  14.  
  15.   AParentAlias = DLLHelloLib->GetParentObject(ParentHWnd);
  16.   TheWindow = new TWindow(AParentAlias, "Hello from a DLL!", DLLHelloLib);
  17.   TheWindow->Attr.Style |= WS_POPUPWINDOW | WS_CAPTION | WS_THICKFRAME
  18.     | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
  19.   TheWindow->Attr.X = 100; TheWindow->Attr.Y = 100;
  20.   TheWindow->Attr.W = 300; TheWindow->Attr.H = 300;
  21.   return (DLLHelloLib->MakeWindow(TheWindow) == TheWindow);
  22. }
  23.  
  24. int FAR PASCAL LibMain(HANDLE hInstance, WORD /*wDataSeg*/,
  25.   WORD /* cbHeapSize */, LPSTR lpCmdLine)
  26. {
  27.     int TheStatus;
  28.  
  29.     DLLHelloLib = new TModule("DLLHello", hInstance, lpCmdLine);
  30.     TheStatus = DLLHelloLib->Status;
  31.     if ( TheStatus != 0 )
  32.     {
  33.       delete DLLHelloLib;
  34.       DLLHelloLib = NULL;
  35.     }
  36.     return (TheStatus == 0);
  37. }
  38.  
  39. int FAR PASCAL WEP(int /*bSystemExit*/)
  40. {
  41.     if ( DLLHelloLib )
  42.       delete DLLHelloLib;
  43.     return 1;
  44. }
  45.