INOLE.CPP
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:2k
源码类别:

Windows编程

开发平台:

Visual C++

  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. #include "inoledll.h"
  12. /*
  13.  * LibMain(32)
  14.  *
  15.  * Purpose:
  16.  *  Entry point for the DLL, conditionally compiled.
  17.  */
  18. #ifdef WIN32
  19. BOOL __stdcall LibMain32(HINSTANCE hInstance, ULONG ulReason
  20.     , PCONTEXT pContext)
  21.     {
  22.     UNREFERENCED_PARAMETER(pContext);
  23.     if (DLL_PROCESS_DETACH==ulReason)
  24.         {
  25.         return TRUE;
  26.         }
  27.     else
  28.         {
  29.         if (DLL_PROCESS_ATTACH!=ulReason)
  30.             return TRUE;
  31.         }
  32.     return Initialize(hInstance);
  33.     }
  34. #else
  35. int WINAPI LibMain(HANDLE hInstance, WORD wDataSeg
  36.     , WORD cbHeapSize, LPTSTR lpCmdLine)
  37.     {
  38.      //Perform global initialization.
  39.     if (Initialize((HINSTANCE)hInstance))
  40.         {
  41.         if (0!=cbHeapSize)
  42.             UnlockData(0);
  43.         }
  44.     return (int)hInstance;
  45.     }
  46. #endif
  47. /*
  48.  * Initialize
  49.  *
  50.  * Purpose:
  51.  *  Registers the control classes contained in this library
  52.  *  and performs other initialization.
  53.  *
  54.  * Parameters:
  55.  *  hInst           HINSTANCE of the DLL that will own this class.
  56.  *
  57.  * Return Value:
  58.  *  BOOL            TRUE all if successful, FALSE otherwise.
  59.  */
  60. BOOL Initialize(HINSTANCE hInst)
  61.     {
  62.     static BOOL     fInitialized=FALSE;
  63.     WNDCLASS        wc;
  64.     if (fInitialized)
  65.         return TRUE;
  66.     wc.cbClsExtra    =0;
  67.     wc.hInstance     =hInst;
  68.     wc.hIcon         =NULL;
  69.     wc.hCursor       =LoadCursor(NULL, IDC_ARROW);
  70.     wc.hbrBackground =(HBRUSH)(COLOR_BTNFACE+1);
  71.     wc.lpszMenuName  =NULL;
  72.     wc.style         =CS_DBLCLKS | CS_GLOBALCLASS
  73.                       | CS_VREDRAW | CS_HREDRAW;
  74.     wc.lpfnWndProc   =GizmoBarWndProc;
  75.     wc.cbWndExtra    =CBEXTRAGIZMOBAR;
  76.     wc.lpszClassName =CLASS_GIZMOBAR;
  77.     RegisterClass(&wc);
  78.     wc.lpfnWndProc   =StatStripWndProc;
  79.     wc.cbWndExtra    =CBEXTRASTATSTRIP;
  80.     wc.lpszClassName =CLASS_STATSTRIP;
  81.     RegisterClass(&wc);
  82.     ToolButtonInit(hInst);
  83.     CursorsCache(hInst);
  84.     fInitialized=TRUE;
  85.     return TRUE;
  86.     }