tn0019.txt 2.0 KB

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