]>
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
9 // Licence: wxWindows licence
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 // Don't implement WinMain if we're building an MFC/wxWindows
38 #if wxUSE_MFC && !defined(NOMAIN)
42 // from src/msw/app.cpp
43 extern void WXDLLEXPORT
wxEntryCleanup();
45 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
49 HINSTANCE wxhInstance
= 0;
51 // ============================================================================
53 // ============================================================================
55 // ----------------------------------------------------------------------------
56 // various entry points
57 // ----------------------------------------------------------------------------
59 // May wish not to have a DllMain or WinMain, e.g. if we're programming
60 // a Netscape plugin or if we're writing a console application
61 #if wxUSE_GUI && !defined(NOMAIN)
63 // NT defines APIENTRY, 3.x not
64 #if !defined(APIENTRY)
65 #define APIENTRY FAR PASCAL
68 /////////////////////////////////////////////////////////////////////////////////
70 // Note that WinMain is also defined in dummy.obj, which is linked to
71 // an application that is using the DLL version of wxWindows.
75 #if defined(__WXMICROWIN__)
76 #define HINSTANCE HANDLE
81 int PASCAL
WinMain(HINSTANCE hInstance
,
82 HINSTANCE hPrevInstance
,
86 return wxEntry((WXHINSTANCE
) hInstance
, (WXHINSTANCE
) hPrevInstance
,
90 #endif // !defined(_WINDLL)
92 /////////////////////////////////////////////////////////////////////////////////
101 // SCD: I don't know why, but also OWL uses this function
102 BOOL WINAPI
DllEntryPoint (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
104 BOOL WINAPI
DllMain (HANDLE hModule
, DWORD fdwReason
, LPVOID lpReserved
)
110 case DLL_PROCESS_ATTACH
:
111 // Only call wxEntry if the application itself is part of the DLL.
112 // If only the wxWindows library is in the DLL, then the
113 // initialisation will be called when the application implicitly
115 return wxEntry((WXHINSTANCE
) hModule
);
117 case DLL_PROCESS_DETACH
:
126 #endif // !WXMAKINGDLL
135 // ----------------------------------------------------------------------------
137 // ----------------------------------------------------------------------------
139 HINSTANCE
wxGetInstance()
144 void wxSetInstance(HINSTANCE hInst
)