]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/main.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: WinMain/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 hybrid app.
37 #if wxUSE_MFC && !defined(NOMAIN)
42 // BC++ has to be special: its run-time expects the DLL entry point to be
43 // named DllEntryPoint instead of the (more) standard DllMain
44 #define DllMain DllEntryPoint
47 #if defined(__WXMICROWIN__)
48 #define HINSTANCE HANDLE
51 // ----------------------------------------------------------------------------
52 // function prototypes
53 // ----------------------------------------------------------------------------
55 // from src/msw/app.cpp
56 extern void WXDLLEXPORT
wxEntryCleanup();
58 // ============================================================================
59 // implementation: various entry points
60 // ============================================================================
62 // May wish not to have a DllMain or WinMain, e.g. if we're programming
63 // a Netscape plugin or if we're writing a console application
64 #if wxUSE_GUI && !defined(NOMAIN)
69 // ----------------------------------------------------------------------------
71 // ----------------------------------------------------------------------------
73 // Note that WinMain is also defined in dummy.obj, which is linked to
74 // an application that is using the DLL version of wxWindows.
78 int PASCAL
WinMain(HINSTANCE hInstance
,
79 HINSTANCE hPrevInstance
,
83 return wxEntry((WXHINSTANCE
) hInstance
,
84 (WXHINSTANCE
) hPrevInstance
,
94 DllMain(HANDLE hModule
, DWORD fdwReason
, LPVOID
WXUNUSED(lpReserved
))
96 // Only call wxEntry if the application itself is part of the DLL.
97 // If only the wxWindows library is in the DLL, then the
98 // initialisation will be called when the application implicitly
103 case DLL_PROCESS_ATTACH
:
104 return wxEntry((WXHINSTANCE
) hModule
);
106 case DLL_PROCESS_DETACH
:
115 #endif // !WXMAKINGDLL
120 #endif // _WINDLL/!_WINDLL
126 // ----------------------------------------------------------------------------
128 // ----------------------------------------------------------------------------
132 HINSTANCE wxhInstance
= 0;
134 HINSTANCE
wxGetInstance()
139 void wxSetInstance(HINSTANCE hInst
)