home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / inole / inole.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  2KB  |  111 lines

  1. /*
  2.  * INOLE.CPP
  3.  * Inside OLE Utilities DLL
  4.  *
  5.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  6.  *
  7.  * Kraig Brockschmidt, Microsoft
  8.  * Internet  :  kraigb@microsoft.com
  9.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  10.  */
  11.  
  12.  
  13. #include "inoledll.h"
  14.  
  15.  
  16. /*
  17.  * LibMain(32)
  18.  *
  19.  * Purpose:
  20.  *  Entry point for the DLL, conditionally compiled.
  21.  */
  22.  
  23. #ifdef WIN32
  24.  
  25. BOOL __stdcall LibMain32(HINSTANCE hInstance, ULONG ulReason
  26.     , PCONTEXT pContext)
  27.     {
  28.     UNREFERENCED_PARAMETER(pContext);
  29.  
  30.     if (DLL_PROCESS_DETACH==ulReason)
  31.         {
  32.         return TRUE;
  33.         }
  34.     else
  35.         {
  36.         if (DLL_PROCESS_ATTACH!=ulReason)
  37.             return TRUE;
  38.         }
  39.  
  40.     return Initialize(hInstance);
  41.     }
  42.  
  43. #else
  44.  
  45. int WINAPI LibMain(HANDLE hInstance, WORD wDataSeg
  46.     , WORD cbHeapSize, LPTSTR lpCmdLine)
  47.     {
  48.      //Perform global initialization.
  49.     if (Initialize((HINSTANCE)hInstance))
  50.         {
  51.         if (0!=cbHeapSize)
  52.             UnlockData(0);
  53.         }
  54.  
  55.     return (int)hInstance;
  56.     }
  57.  
  58. #endif
  59.  
  60.  
  61.  
  62. /*
  63.  * Initialize
  64.  *
  65.  * Purpose:
  66.  *  Registers the control classes contained in this library
  67.  *  and performs other initialization.
  68.  *
  69.  * Parameters:
  70.  *  hInst           HINSTANCE of the DLL that will own this class.
  71.  *
  72.  * Return Value:
  73.  *  BOOL            TRUE all if successful, FALSE otherwise.
  74.  */
  75.  
  76. BOOL Initialize(HINSTANCE hInst)
  77.     {
  78.     static BOOL     fInitialized=FALSE;
  79.     WNDCLASS        wc;
  80.  
  81.     if (fInitialized)
  82.         return TRUE;
  83.  
  84.     wc.cbClsExtra    =0;
  85.     wc.hInstance     =hInst;
  86.     wc.hIcon         =NULL;
  87.     wc.hCursor       =LoadCursor(NULL, IDC_ARROW);
  88.     wc.hbrBackground =(HBRUSH)(COLOR_BTNFACE+1);
  89.     wc.lpszMenuName  =NULL;
  90.     wc.style         =CS_DBLCLKS | CS_GLOBALCLASS
  91.                       | CS_VREDRAW | CS_HREDRAW;
  92.  
  93.     wc.lpfnWndProc   =GizmoBarWndProc;
  94.     wc.cbWndExtra    =CBEXTRAGIZMOBAR;
  95.     wc.lpszClassName =CLASS_GIZMOBAR;
  96.  
  97.     RegisterClass(&wc);
  98.  
  99.     wc.lpfnWndProc   =StatStripWndProc;
  100.     wc.cbWndExtra    =CBEXTRASTATSTRIP;
  101.     wc.lpszClassName =CLASS_STATSTRIP;
  102.  
  103.     RegisterClass(&wc);
  104.  
  105.     ToolButtonInit(hInst);
  106.     CursorsCache(hInst);
  107.  
  108.     fInitialized=TRUE;
  109.     return TRUE;
  110.     }
  111.