]>
Commit | Line | Data |
---|---|---|
26cdd42d VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/init.h | |
3 | // Purpose: Windows-specific wxEntry() overload | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_MSW_INIT_H_ | |
13 | #define _WX_MSW_INIT_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // Windows-specific wxEntry() overload and wxIMPLEMENT_WXWIN_MAIN definition | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | // we need HINSTANCE declaration to define WinMain() | |
20 | #include "wx/msw/wrapwin.h" | |
21 | ||
22 | #ifndef SW_SHOWNORMAL | |
23 | #define SW_SHOWNORMAL 1 | |
24 | #endif | |
25 | ||
26 | // WinMain() is always ANSI, even in Unicode build, under normal Windows | |
27 | // but is always Unicode under CE | |
28 | #ifdef __WXWINCE__ | |
29 | typedef wchar_t *wxCmdLineArgType; | |
30 | #else | |
31 | typedef char *wxCmdLineArgType; | |
32 | #endif | |
33 | ||
34 | // Windows-only overloads of wxEntry() and wxEntryStart() which take the | |
35 | // parameters passed to WinMain() instead of those passed to main() | |
36 | extern WXDLLIMPEXP_CORE bool | |
37 | wxEntryStart(HINSTANCE hInstance, | |
38 | HINSTANCE hPrevInstance = NULL, | |
39 | wxCmdLineArgType pCmdLine = NULL, | |
40 | int nCmdShow = SW_SHOWNORMAL); | |
41 | ||
42 | extern WXDLLIMPEXP_CORE int | |
43 | wxEntry(HINSTANCE hInstance, | |
44 | HINSTANCE hPrevInstance = NULL, | |
45 | wxCmdLineArgType pCmdLine = NULL, | |
46 | int nCmdShow = SW_SHOWNORMAL); | |
47 | ||
48 | #if defined(__BORLANDC__) && wxUSE_UNICODE | |
49 | // Borland C++ has the following nonstandard behaviour: when the -WU | |
50 | // command line flag is used, the linker expects to find wWinMain instead | |
51 | // of WinMain. This flag causes the compiler to define _UNICODE and | |
52 | // UNICODE symbols and there's no way to detect its use, so we have to | |
53 | // define both WinMain and wWinMain so that wxIMPLEMENT_WXWIN_MAIN works | |
54 | // for both code compiled with and without -WU. | |
55 | // See http://sourceforge.net/tracker/?func=detail&atid=309863&aid=1935997&group_id=9863 | |
56 | // for more details. | |
57 | #define wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD \ | |
58 | extern "C" int WINAPI wWinMain(HINSTANCE hInstance, \ | |
59 | HINSTANCE hPrevInstance, \ | |
60 | wchar_t * WXUNUSED(lpCmdLine), \ | |
61 | int nCmdShow) \ | |
62 | { \ | |
63 | wxDISABLE_DEBUG_SUPPORT(); \ | |
64 | \ | |
65 | /* NB: wxEntry expects lpCmdLine argument to be char*, not */ \ | |
66 | /* wchar_t*, but fortunately it's not used anywhere */ \ | |
67 | /* and we can simply pass NULL in: */ \ | |
68 | return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ | |
69 | } | |
70 | #else | |
71 | #define wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD | |
72 | #endif // defined(__BORLANDC__) && wxUSE_UNICODE | |
73 | ||
74 | #define wxIMPLEMENT_WXWIN_MAIN \ | |
75 | extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ | |
76 | HINSTANCE hPrevInstance, \ | |
77 | wxCmdLineArgType WXUNUSED(lpCmdLine), \ | |
78 | int nCmdShow) \ | |
79 | { \ | |
80 | wxDISABLE_DEBUG_SUPPORT(); \ | |
81 | \ | |
82 | /* NB: We pass NULL in place of lpCmdLine to behave the same as */ \ | |
83 | /* Borland-specific wWinMain() above. If it becomes needed */ \ | |
84 | /* to pass lpCmdLine to wxEntry() here, you'll have to fix */ \ | |
85 | /* wWinMain() above too. */ \ | |
86 | return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); \ | |
87 | } \ | |
88 | wxIMPLEMENT_WXWIN_MAIN_BORLAND_NONSTANDARD | |
89 | ||
90 | ||
91 | #endif // _WX_MSW_INIT_H_ |