From bffa02ff6fc8b0f66d6486a965c45804a7f50e33 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 11 May 2003 22:43:28 +0000 Subject: [PATCH] added WinStruct<> git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/private.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index d1f5d61b8c..31a435f2a4 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -330,6 +330,19 @@ inline RECT wxGetClientRect(HWND hwnd) // small helper classes // --------------------------------------------------------------------------- +// a template to make initializing Windows styructs less painful: it zeroes all +// the struct fields and also sets cbSize member to the correct value (and so +// can be only used with structures which have this member...) +template +struct WinStruct : public T +{ + WinStruct() + { + ::ZeroMemory(this, cbSize = sizeof(T)); + } +}; + + // create an instance of this class and use it as the HDC for screen, will // automatically release the DC going out of scope class ScreenHDC -- 2.45.2