]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/main.cpp
applied patch 411059 (mingw win32 api version check)
[wxWidgets.git] / src / msw / main.cpp
index 3f8833f408bdeeab61e244fd68147afed85cff20..237eb9eee3d0857f92f5fe497aa37ca484482a1d 100644 (file)
@@ -33,6 +33,9 @@
 
 #include "wx/msw/private.h"
 
 
 #include "wx/msw/private.h"
 
+// from src/msw/app.cpp
+extern void WXDLLEXPORT wxEntryCleanup();
+
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
@@ -95,22 +98,24 @@ BOOL WINAPI DllEntryPoint (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
 BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
 #endif
 {
 BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
 #endif
 {
+#ifndef WXMAKINGDLL
     switch (fdwReason)
     {
         case DLL_PROCESS_ATTACH:
             // Only call wxEntry if the application itself is part of the DLL.
     switch (fdwReason)
     {
         case DLL_PROCESS_ATTACH:
             // Only call wxEntry if the application itself is part of the DLL.
-            // If only the wxWindows library is in the DLL, then the initialisation
-            // will be called when the application implicitly calls WinMain.
-
-#if !defined(WXMAKINGDLL)
+            // If only the wxWindows library is in the DLL, then the
+            // initialisation will be called when the application implicitly
+            // calls WinMain.
             return wxEntry((WXHINSTANCE) hModule);
             return wxEntry((WXHINSTANCE) hModule);
-#endif
-            break;
 
         case DLL_PROCESS_DETACH:
 
         case DLL_PROCESS_DETACH:
-        default:
-            break;
+           if ( wxTheApp )
+              wxTheApp->OnExit();
+           wxEntryCleanup();
+           break;
     }
     }
+#endif // !WXMAKINGDLL
+
     return TRUE;
 }
 
     return TRUE;
 }