]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/main.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Main/DllMain
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
34 #include "wx/msw/private.h"
36 // from src/msw/app.cpp
37 extern void WXDLLEXPORT
wxEntryCleanup();
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 HINSTANCE wxhInstance
= 0;
45 // ============================================================================
47 // ============================================================================
49 // ----------------------------------------------------------------------------
50 // various entry points
51 // ----------------------------------------------------------------------------
53 // May wish not to have a DllMain or WinMain, e.g. if we're programming
54 // a Netscape plugin or if we're writing a console application
55 #if wxUSE_GUI && !defined(NOMAIN)
57 // NT defines APIENTRY, 3.x not
58 #if !defined(APIENTRY)
59 #define APIENTRY FAR PASCAL
62 /////////////////////////////////////////////////////////////////////////////////
64 // Note that WinMain is also defined in dummy.obj, which is linked to
65 // an application that is using the DLL version of wxWindows.
69 #if defined(__TWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__)
70 #define HINSTANCE HANDLE
75 int PASCAL
WinMain(HINSTANCE hInstance
,
76 HINSTANCE hPrevInstance
,
80 return wxEntry((WXHINSTANCE
) hInstance
, (WXHINSTANCE
) hPrevInstance
,
84 #endif // !defined(_WINDLL)
86 /////////////////////////////////////////////////////////////////////////////////
95 // SCD: I don't know why, but also OWL uses this function
96 BOOL WINAPI
DllEntryPoint (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
98 BOOL WINAPI
DllMain (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
104 case DLL_PROCESS_ATTACH
:
105 // Only call wxEntry if the application itself is part of the DLL.
106 // If only the wxWindows library is in the DLL, then the
107 // initialisation will be called when the application implicitly
109 return wxEntry((WXHINSTANCE
) hModule
);
111 case DLL_PROCESS_DETACH
:
120 #endif // !WXMAKINGDLL
129 // ----------------------------------------------------------------------------
131 // ----------------------------------------------------------------------------
133 HINSTANCE
wxGetInstance()
138 void wxSetInstance(HINSTANCE hInst
)