home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / REFERENC / LEARNVBX / CCINIT.C next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.3 KB  |  80 lines

  1. //---------------------------------------------------------------------------
  2. // ccInit.c
  3. //---------------------------------------------------------------------------
  4. // Custom Control DLL Initialization
  5. //---------------------------------------------------------------------------
  6.  
  7. #define  NOCOMM
  8. #include <windows.h>
  9.  
  10. #include <vbapi.h>
  11.  
  12.  
  13. //---------------------------------------------------------------------------
  14. // Global Variables
  15. //---------------------------------------------------------------------------
  16. extern MODEL modelPush;     // From push.h
  17. HANDLE hmodDLL;
  18.  
  19.  
  20. //---------------------------------------------------------------------------
  21. // Register custom control.
  22. //    This routine is called by VB when the custom control DLL is
  23. //    loaded for use.
  24. //---------------------------------------------------------------------------
  25. BOOL FAR PASCAL _export VBINITCC
  26. (
  27.     USHORT usVersion,
  28.     BOOL   fRuntime
  29. )
  30. {
  31.     // Avoid warnings on unused (but required) formal parameters
  32.     fRuntime  = fRuntime;
  33.     usVersion = usVersion;
  34.  
  35.     // Register control(s)
  36.     return VBRegisterModel(hmodDLL, &modelPush);
  37. }
  38.  
  39.  
  40. //---------------------------------------------------------------------------
  41. // Initialize library.
  42. //    This routine is called from the DLL entry point in LIBINIT.ASM
  43. //    which is called when the first client loads the DLL.
  44. //---------------------------------------------------------------------------
  45. BOOL FAR PASCAL LibMain
  46. (
  47.     HANDLE hmod,
  48.     HANDLE segDS,
  49.     USHORT cbHeapSize
  50. )
  51. {
  52.     // Avoid warnings on unused (but required) formal parameters
  53.     cbHeapSize = cbHeapSize;
  54.     segDS = segDS;
  55.  
  56.     hmodDLL = hmod;
  57.  
  58.     // Leave our DS unlocked when we're not running
  59.     UnlockData( 0 );
  60.  
  61.     return TRUE;
  62. }
  63.  
  64.  
  65. //---------------------------------------------------------------------------
  66. // Handle exit notification from Windows.
  67. //    This routine is called by Windows when the library is freed
  68. //    by its last client.
  69. //---------------------------------------------------------------------------
  70. VOID FAR PASCAL _export WEP
  71. (
  72.     BOOL fSystemExit
  73. )
  74. {
  75.     // Avoid warnings on unused (but required) formal parameters
  76.     fSystemExit = fSystemExit;
  77. }
  78.  
  79. //---------------------------------------------------------------------------
  80.