home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / appwiz / customwz / template / root.cpp < prev    next >
C/C++ Source or Header  |  1998-03-05  |  1KB  |  41 lines

  1. // $$root$$.cpp : Defines the initialization routines for the DLL.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <afxdllx.h>
  6. #include "$$root$$.h"
  7. #include "$$filebase$$aw.h"
  8.  
  9. #ifdef _PSEUDO_DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. static AFX_EXTENSION_MODULE $$safe_root$$DLL = { NULL, NULL };
  15.  
  16. extern "C" int APIENTRY
  17. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  18. {
  19.     if (dwReason == DLL_PROCESS_ATTACH)
  20.     {
  21.         TRACE0("$$ROOT$$.AWX Initializing!\n");
  22.  
  23.         // Extension DLL one-time initialization
  24.         AfxInitExtensionModule($$safe_root$$DLL, hInstance);
  25.  
  26.         // Insert this DLL into the resource chain
  27.         new CDynLinkLibrary($$safe_root$$DLL);
  28.  
  29.         // Register this custom AppWizard with MFCAPWZ.DLL
  30.         SetCustomAppWizClass(&$$safe_root$$aw);
  31.     }
  32.     else if (dwReason == DLL_PROCESS_DETACH)
  33.     {
  34.         TRACE0("$$ROOT$$.AWX Terminating!\n");
  35.  
  36.         // Terminate the library before destructors are called
  37.         AfxTermExtensionModule($$safe_root$$DLL);
  38.     }
  39.     return 1;   // ok
  40. }
  41.