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