X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c5da5e42d54e0d660a04f4160c60b27090656c8..6900d12d6986dc23ab5efb689405ea21d52d41be:/include/wx/msw/private.h diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 883ad9932c..9489b2fd68 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -193,6 +193,21 @@ extern LONG APIENTRY _EXPORT #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) #endif +// close the handle in the class dtor +class AutoHANDLE +{ +public: + wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { } + + bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; } + operator HANDLE() const { return m_handle; } + + ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); } + +protected: + HANDLE m_handle; +}; + #if wxUSE_GUI #include @@ -736,7 +751,7 @@ enum wxWinVersion wxWinVersion_NT6 = 0x0600 }; -extern wxWinVersion wxGetWinVersion(); +WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); #if wxUSE_GUI