home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / VB_SLIDE / CCINIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-07  |  2.7 KB  |  103 lines

  1. //---------------------------------------------------------------------------
  2. // ccInit.c
  3. //---------------------------------------------------------------------------
  4. // Custom Control DLL Initialization
  5. //---------------------------------------------------------------------------
  6.  
  7. #define NOCOMM
  8.  
  9. #include <windows.h>
  10.  
  11. #define CTL_DATA    // cause the control structures to be declared
  12.  
  13. #include "vbapi.h"
  14. #include "slider.h"
  15.  
  16. HANDLE    hmodDLL;
  17.  
  18. //---------------------------------------------------------------------------
  19. // Register custom control.
  20. //    This routine is called by VB when the custom control DLL is
  21. //    loaded for use.
  22. //---------------------------------------------------------------------------
  23.  
  24. BOOL FAR PASCAL _export VBINITCC
  25. (
  26.     USHORT usVersion,
  27.     BOOL fRuntime
  28. )
  29. {
  30.     // avoid warnings on unused (but required) formal parameters
  31.  
  32.     fRuntime = fRuntime;
  33.     usVersion = usVersion;
  34.  
  35.     // Register control(s)
  36.  
  37.     if (!VBRegisterModel(hmodDLL, &modelSlider))
  38.     return FALSE;
  39.  
  40.     return TRUE;
  41. }
  42.  
  43. //---------------------------------------------------------------------------
  44. // Initialize library.
  45. //    This routine is called from the DLL entry point in LIBINIT.ASM
  46. //    which is called when the first client loads the DLL.
  47. //---------------------------------------------------------------------------
  48.  
  49. BOOL FAR LibMain
  50. (
  51.     HANDLE    hmod,
  52.     HANDLE    segDS,
  53.     USHORT    cbHeapSize
  54. )
  55. {
  56.     BITMAP    bmp;
  57.  
  58.     // avoid warnings on unused (but required) formal parameters
  59.  
  60.     cbHeapSize = cbHeapSize;
  61.     segDS = segDS;
  62.  
  63.     hmodDLL = hmod;
  64.  
  65.     hbmpSlide  = LoadBitmap(hmodDLL, MAKEINTRESOURCE(IDBMP_SLIDE));
  66.     hbmpButton = LoadBitmap(hmodDLL, MAKEINTRESOURCE(IDBMP_BUTTON));
  67.     hbmpMask   = LoadBitmap(hmodDLL, MAKEINTRESOURCE(IDBMP_MASK));
  68.  
  69.     if (!hbmpSlide || !hbmpButton || !hbmpMask) {
  70.     MessageBox(NULL, "cannot load bitmaps", "SLIDER",
  71.            MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
  72.     return FALSE;
  73.     }
  74.  
  75.     GetObject(hbmpSlide, sizeof(BITMAP), (LPSTR)&bmp);
  76.     sSlideWidth  = bmp.bmWidth;
  77.     sSlideHeight = bmp.bmHeight;
  78.  
  79.     GetObject(hbmpButton, sizeof(BITMAP), (LPSTR)&bmp);
  80.     sButtonWidth  = bmp.bmWidth;
  81.     sButtonHeight = bmp.bmHeight;
  82.  
  83.     return TRUE;
  84. }
  85.  
  86. //---------------------------------------------------------------------------
  87. // Handle exit notification from Windows
  88. //    This routine is called by Windows when the library is freed
  89. //    by its last client.
  90. //---------------------------------------------------------------------------
  91.  
  92. VOID FAR _export WEP
  93. (
  94.     BOOL    fSystemExit
  95. )
  96. {
  97.     // avoid warnings on unused (but required) formal parameters
  98.  
  99.     fSystemExit = fSystemExit;
  100. }
  101.  
  102. //---------------------------------------------------------------------------
  103.