]>
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 // ----------------------------------------------------------------------------
38 // ----------------------------------------------------------------------------
40 HINSTANCE wxhInstance
= 0;
42 // ============================================================================
44 // ============================================================================
46 // ----------------------------------------------------------------------------
47 // various entry points
48 // ----------------------------------------------------------------------------
50 // May wish not to have a DllMain or WinMain, e.g. if we're programming
51 // a Netscape plugin or if we're writing a console application
52 #if wxUSE_GUI && !defined(NOMAIN)
54 // NT defines APIENTRY, 3.x not
55 #if !defined(APIENTRY)
56 #define APIENTRY FAR PASCAL
59 /////////////////////////////////////////////////////////////////////////////////
61 // Note that WinMain is also defined in dummy.obj, which is linked to
62 // an application that is using the DLL version of wxWindows.
66 #if defined(__TWIN32__) || defined(__WXWINE__)
69 BOOL PASCAL
WinMain(HANDLE hInstance
, HANDLE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
79 WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
84 return wxEntry((WXHINSTANCE
) hInstance
, (WXHINSTANCE
) hPrevInstance
, lpCmdLine
, nCmdShow
);
88 /////////////////////////////////////////////////////////////////////////////////
97 // SCD: I don't know why, but also OWL uses this function
98 BOOL WINAPI
DllEntryPoint (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
100 BOOL WINAPI
DllMain (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
105 case DLL_PROCESS_ATTACH
:
106 // Only call wxEntry if the application itself is part of the DLL.
107 // If only the wxWindows library is in the DLL, then the initialisation
108 // will be called when the application implicitly calls WinMain.
110 #if !defined(WXMAKINGDLL)
111 return wxEntry((WXHINSTANCE
) hModule
);
115 case DLL_PROCESS_DETACH
:
126 // ----------------------------------------------------------------------------
128 // ----------------------------------------------------------------------------
130 HINSTANCE
wxGetInstance()
135 void wxSetInstance(HINSTANCE hInst
)