]> git.saurik.com Git - wxWidgets.git/commitdiff
don't give errors if SetLayeredWindowAttributes() is not available (as is the case...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Sep 2008 21:41:47 +0000 (21:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Sep 2008 21:41:47 +0000 (21:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/toplevel.cpp

index faa55fe617097f998df466e29aaf6cf5bad7e264..531e165bb6fe1219016181f4a0ffca68334bf72c 100644 (file)
@@ -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