]>
Commit | Line | Data |
---|---|---|
889e597c VZ |
1 | Special notes about writing wxMSW code |
2 | ====================================== | |
3 | ||
4 | 0. Purpose | |
5 | ---------- | |
6 | ||
7 | This is just a collection of various notes which should be useful to anybody | |
8 | working on wxMSW codebase, please feel free to add more here. | |
9 | ||
10 | This text assumes familiarity with both Windows programming and wxWidgets so it | |
11 | doesn't cover any wxWidgets-wide issues not specific to Windows. | |
12 | ||
13 | ||
14 | 1. Windows headers wrappers | |
15 | --------------------------- | |
16 | ||
17 | In no event should the Windows headers such as <windows.h> or <commctrl.h> be | |
18 | included directly. So instead of #include <...> use "wx/msw/wrapwin.h" or | |
19 | "wx/msw/wrapcctl.h". | |
20 | ||
21 | For convenience it is also possible to replace #include <commdlg.h> and | |
22 | <shlobj.h> with #include "wx/msw/wrapcdlg.h" and wrapshl.h but this is less | |
23 | vital. | |
24 | ||
25 | Also notice that many convenient (albeit undocumented) functions and classes | |
26 | are declared in "wx/msw/private.h", please do become familiar with this file | |
27 | contents and use the utility classes and functions from it instead of | |
28 | duplicating their functionality (which can often be done only in exception | |
29 | unsafe way). | |
30 | ||
31 | ||
32 | 2. Windows features checks | |
33 | -------------------------- | |
34 | ||
35 | All checks of features not present in all Windows versions must be done both at | |
36 | compile-time (because, even though we use maximal value for WINVER in our code, | |
37 | some compilers come with headers too old to declare them) and at run-time | |
38 | (because wxMSW applications should run everywhere). | |
39 | ||
40 | The functions wxGetWinVersion() (from wx/msw/private.h) and wxApp:: | |
41 | GetComCtl32Version() should be used to check Windows and comctl32.dll versions | |
42 | respectively. | |
43 | ||
44 | Any functions which may not be present in kernel32.dll/user32.dll/... in all | |
45 | Windows versions should be resolved dynamically, i.e. using wxDynamicLibrary as | |
46 | otherwise any wx application -- even not needing them at all -- would refuse to | |
47 | start up on Windows versions not implementing the feature in question. As an | |
48 | example, look at AlphaBlt()-related code in src/msw/dc.cpp. | |
49 | ||
50 | ||
51 | === EOF === | |
52 | ||
53 | Author: VZ |