From d7e33a52917319b9ef500b7da0cadc465e695cbf Mon Sep 17 00:00:00 2001 From: PB Date: Wed, 3 Nov 2021 16:57:12 +0100 Subject: [PATCH] Extend wxMSW contributor guide List useful wrapper classes for Windows API provided by wxWidgets. Closes https://github.com/wxWidgets/wxWidgets/pull/2578 --- docs/contributing/wxmsw-contributor-guide.md | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/contributing/wxmsw-contributor-guide.md b/docs/contributing/wxmsw-contributor-guide.md index fafc7b4987..9cafd730b3 100644 --- a/docs/contributing/wxmsw-contributor-guide.md +++ b/docs/contributing/wxmsw-contributor-guide.md @@ -28,8 +28,28 @@ contents and use the utility classes and functions from it instead of duplicating their functionality (which can often be done only in exception unsafe way). +2. Utility classes +--------------------------- -2. Windows features checks +wxWidgets provides a couple of useful (mostly undocumented) classes making +Windows API easier to work with. + +Please whenever possible do not use raw pointers for BSTR, COM interfaces +or task memory, use the appropriate RAII wrapper instead (see below). + +Grep wxWidgets source code for the class name to see how it is to be used. + +*wxBasicString*: for `BSTR`, in `"wx/msw/ole/oleutils.h"` + +*wxCOMPtr*: simplistic smart pointer for COM interfaces, in `"wx/msw/private/comptr.h"` + +*wxCoTaskMemPtr*: smart pointer for memory allocated/freed with `CoTaskMem{Alloc/Free}()`, +in `"wx/msw/private/cotaskmemptr.h"` + +*wxSafeArray*: for `SAFEARRAY`, in `"wx/msw/ole/safearray.h"` + + +3. Windows features checks -------------------------- All checks of features not present in all Windows versions must be done both at