PKIFResources.cpp

Go to the documentation of this file.
00001 
00009 #include "PKIFResources.h"
00010 
00011 #if defined(WIN32)
00012     #define WIN32_LEAN_AND_MEAN
00013     #define _WIN32_WINNT 0x0500
00014     #include "windows.h"
00015 #include <wx/msw/private.h>
00016 #endif
00017 
00018 #if defined(USE_VLD)
00019 #include <vld.h>
00020 #endif
00021 
00022 #if defined(_MANAGED)
00023 #pragma managed(push, off)
00024 #endif //defined(_MANAGED)
00025 
00026 #if !defined(PKIFRESOURCES_STATIC)
00027 
00028 #include "wx/wx.h"
00029 
00030 class resDLLApp : public wxApp
00031 {
00032 public:
00033     bool OnInit();
00034     DECLARE_EVENT_TABLE()
00035 };
00036 
00037 
00038 
00039 
00040 BEGIN_EVENT_TABLE(resDLLApp, wxApp)
00041 END_EVENT_TABLE()
00042 
00043 IMPLEMENT_APP_NO_MAIN(resDLLApp)
00044 
00045 bool resDLLApp::OnInit()
00046 {
00047     return true;
00048 }
00049 
00050 BOOL APIENTRY DllMain( HMODULE hModule,
00051                       DWORD  ul_reason_for_call,
00052                       LPVOID lpReserved
00053                       )
00054 {
00055     switch (ul_reason_for_call)
00056     {
00057     case DLL_PROCESS_ATTACH:
00058         {
00059             HINSTANCE hi = (HINSTANCE)hModule;
00060             // this is critical when wx is used from a dll
00061             wxSetInstance(hi);
00062 
00063             // need to set up the global wxTheApp object to get event loops and such in order
00064             int argc = 0;
00065             char **argv = 0;
00066             if(!wxEntryStart(argc,argv)) {
00067                 return FALSE;
00068             }
00069 
00070             // and perform any initialization that might require.
00071             // in this case, CallOnInit() should be doing nothing but returning true,
00072             // so this amounts to nothing more than checking that wxEntryStart() did its thing
00073             if(!wxTheApp || !wxTheApp->CallOnInit()) {
00074                 return FALSE;
00075             }
00076 
00077             // there's no need to get called when threads attach and detach. we do nothing.
00078             DisableThreadLibraryCalls(hModule);
00079 
00080             break;
00081         }
00082     case DLL_THREAD_ATTACH:
00083     case DLL_THREAD_DETACH:
00084         break;
00085     case DLL_PROCESS_DETACH:
00086         // whenever wxEntryStart() is used instead of the normal wxEntry stuff
00087         // wxEntryCleanup() is needed
00088         wxEntryCleanup();
00089         break;
00090     }
00091     return TRUE;
00092 }
00093 
00094 
00095 #endif
00096 
00097 #ifdef _MANAGED
00098 #pragma managed(pop)
00099 #endif

Generated on Mon Nov 15 11:15:55 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6