]>
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(__WXWINE__)
70 #define HINSTANCE HINSTANCE__*
73 #elif defined(__TWIN32__) || defined(__WXMICROWIN__)
74 #define HINSTANCE HANDLE
79 int PASCAL
WinMain(HINSTANCE hInstance
,
80 HINSTANCE hPrevInstance
,
84 return wxEntry((WXHINSTANCE
) hInstance
, (WXHINSTANCE
) hPrevInstance
,
88 #endif // !defined(_WINDLL)
90 /////////////////////////////////////////////////////////////////////////////////
99 // SCD: I don't know why, but also OWL uses this function
100 BOOL WINAPI
DllEntryPoint (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
102 BOOL WINAPI
DllMain (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
108 case DLL_PROCESS_ATTACH
:
109 // Only call wxEntry if the application itself is part of the DLL.
110 // If only the wxWindows library is in the DLL, then the
111 // initialisation will be called when the application implicitly
113 return wxEntry((WXHINSTANCE
) hModule
);
115 case DLL_PROCESS_DETACH
:
124 #endif // !WXMAKINGDLL
133 // ----------------------------------------------------------------------------
135 // ----------------------------------------------------------------------------
137 HINSTANCE
wxGetInstance()
142 void wxSetInstance(HINSTANCE hInst
)