From caf587aaeb7d3ae631446d32dc45dc3cbf724528 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Sep 2008 21:41:47 +0000 Subject: [PATCH] don't give errors if SetLayeredWindowAttributes() is not available (as is the case under Win95) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/toplevel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index faa55fe617..531e165bb6 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -1131,15 +1131,23 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) { #if wxUSE_DYNLIB_CLASS typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD); - static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL; + static PSETLAYEREDWINDOWATTR + pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR)-1; - if ( pSetLayeredWindowAttributes == NULL ) + if ( pSetLayeredWindowAttributes == (PSETLAYEREDWINDOWATTR)-1 ) { wxDynamicLibrary dllUser32(_T("user32.dll")); + + // use RawGetSymbol() and not GetSymbol() to avoid error messages under + // Windows 95: there is nothing the user can do about this anyhow pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR) - dllUser32.GetSymbol(wxT("SetLayeredWindowAttributes")); + dllUser32.RawGetSymbol(wxT("SetLayeredWindowAttributes")); + + // it's ok to destroy dllUser32 here, we link statically to user32.dll + // anyhow so it won't be unloaded } - if ( pSetLayeredWindowAttributes == NULL ) + + if ( !pSetLayeredWindowAttributes ) return false; #endif // wxUSE_DYNLIB_CLASS