]>
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__)
67 #define HINSTANCE HANDLE
72 int PASCAL
WinMain(HINSTANCE hInstance
,
73 HINSTANCE hPrevInstance
,
77 return wxEntry((WXHINSTANCE
) hInstance
, (WXHINSTANCE
) hPrevInstance
,
81 #endif // !defined(_WINDLL)
83 /////////////////////////////////////////////////////////////////////////////////
92 // SCD: I don't know why, but also OWL uses this function
93 BOOL WINAPI
DllEntryPoint (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
95 BOOL WINAPI
DllMain (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
100 case DLL_PROCESS_ATTACH
:
101 // Only call wxEntry if the application itself is part of the DLL.
102 // If only the wxWindows library is in the DLL, then the initialisation
103 // will be called when the application implicitly calls WinMain.
105 #if !defined(WXMAKINGDLL)
106 return wxEntry((WXHINSTANCE
) hModule
);
110 case DLL_PROCESS_DETACH
:
121 // ----------------------------------------------------------------------------
123 // ----------------------------------------------------------------------------
125 HINSTANCE
wxGetInstance()
130 void wxSetInstance(HINSTANCE hInst
)