Remove dynamic loading of SetLayeredWindowAttributes and FlashWindowEx.
FlashWindowEx is available since WinXP. SetLayeredWindowAttributes is available since Win2k.
This commit is contained in:
@@ -1078,22 +1078,7 @@ bool wxTopLevelWindowMSW::EnableMinimizeButton(bool enable)
|
|||||||
|
|
||||||
void wxTopLevelWindowMSW::RequestUserAttention(int flags)
|
void wxTopLevelWindowMSW::RequestUserAttention(int flags)
|
||||||
{
|
{
|
||||||
#if defined(FLASHW_STOP) && wxUSE_DYNLIB_CLASS
|
#if defined(FLASHW_STOP)
|
||||||
// available in the headers, check if it is supported by the system
|
|
||||||
typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi);
|
|
||||||
static FlashWindowEx_t s_pfnFlashWindowEx = NULL;
|
|
||||||
if ( !s_pfnFlashWindowEx )
|
|
||||||
{
|
|
||||||
wxDynamicLibrary dllUser32(wxT("user32.dll"));
|
|
||||||
s_pfnFlashWindowEx = (FlashWindowEx_t)
|
|
||||||
dllUser32.GetSymbol(wxT("FlashWindowEx"));
|
|
||||||
|
|
||||||
// we can safely unload user32.dll here, it's going to remain loaded as
|
|
||||||
// long as the program is running anyhow
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( s_pfnFlashWindowEx )
|
|
||||||
{
|
|
||||||
WinStruct<FLASHWINFO> fwi;
|
WinStruct<FLASHWINFO> fwi;
|
||||||
fwi.hwnd = GetHwnd();
|
fwi.hwnd = GetHwnd();
|
||||||
fwi.dwFlags = FLASHW_ALL;
|
fwi.dwFlags = FLASHW_ALL;
|
||||||
@@ -1108,14 +1093,13 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags)
|
|||||||
fwi.dwFlags |= FLASHW_TIMERNOFG;
|
fwi.dwFlags |= FLASHW_TIMERNOFG;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_pfnFlashWindowEx(&fwi);
|
::FlashWindowEx(&fwi);
|
||||||
}
|
#else
|
||||||
else // FlashWindowEx() not available
|
|
||||||
#endif // FlashWindowEx() defined
|
|
||||||
{
|
{
|
||||||
wxUnusedVar(flags);
|
wxUnusedVar(flags);
|
||||||
::FlashWindow(GetHwnd(), TRUE);
|
::FlashWindow(GetHwnd(), TRUE);
|
||||||
}
|
}
|
||||||
|
#endif // defined(FLASHW_STOP)
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const
|
wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const
|
||||||
@@ -1157,28 +1141,6 @@ wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const
|
|||||||
|
|
||||||
bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
|
bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
|
||||||
{
|
{
|
||||||
#if wxUSE_DYNLIB_CLASS
|
|
||||||
typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
|
|
||||||
static PSETLAYEREDWINDOWATTR
|
|
||||||
pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR)-1;
|
|
||||||
|
|
||||||
if ( pSetLayeredWindowAttributes == (PSETLAYEREDWINDOWATTR)-1 )
|
|
||||||
{
|
|
||||||
wxDynamicLibrary dllUser32(wxT("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.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 )
|
|
||||||
return false;
|
|
||||||
#endif // wxUSE_DYNLIB_CLASS
|
|
||||||
|
|
||||||
LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
|
LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
|
||||||
|
|
||||||
// if setting alpha to fully opaque then turn off the layered style
|
// if setting alpha to fully opaque then turn off the layered style
|
||||||
@@ -1189,14 +1151,12 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_DYNLIB_CLASS
|
|
||||||
// Otherwise, set the layered style if needed and set the alpha value
|
// Otherwise, set the layered style if needed and set the alpha value
|
||||||
if ((exstyle & WS_EX_LAYERED) == 0 )
|
if ((exstyle & WS_EX_LAYERED) == 0 )
|
||||||
SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
|
SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
|
||||||
|
|
||||||
if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
|
if ( ::SetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
|
||||||
return true;
|
return true;
|
||||||
#endif // wxUSE_DYNLIB_CLASS
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user