+ return true;
+}
+
+#ifndef __WXWINCE__
+
+bool wxTopLevelWindowMSW::SetShape(const wxRegion& region)
+{
+ wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
+ _T("Shaped windows must be created with the wxFRAME_SHAPED style."));
+
+ // The empty region signifies that the shape should be removed from the
+ // window.
+ if ( region.IsEmpty() )
+ {
+ if (::SetWindowRgn(GetHwnd(), NULL, TRUE) == 0)
+ {
+ wxLogLastError(_T("SetWindowRgn"));
+ return false;
+ }
+ return true;
+ }
+
+ // Windows takes ownership of the region, so
+ // we'll have to make a copy of the region to give to it.
+ DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL);
+ RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
+ ::GetRegionData(GetHrgnOf(region), noBytes, rgnData);
+ HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData);
+ delete[] (char*) rgnData;
+
+ // SetWindowRgn expects the region to be in coordinants
+ // relative to the window, not the client area. Figure
+ // out the offset, if any.
+ RECT rect;
+ DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
+ DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE);
+ ::GetClientRect(GetHwnd(), &rect);
+ ::AdjustWindowRectEx(&rect, dwStyle, FALSE, dwExStyle);
+ ::OffsetRgn(hrgn, -rect.left, -rect.top);
+
+ // Now call the shape API with the new region.
+ if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)
+ {
+ wxLogLastError(_T("SetWindowRgn"));
+ return false;
+ }
+ return true;
+}
+
+#endif // !__WXWINCE__
+
+void wxTopLevelWindowMSW::RequestUserAttention(int flags)
+{
+ // check if we can use FlashWindowEx(): unfortunately an explicit test for
+ // FLASHW_STOP, for example, doesn't work because MSVC6 headers do #define
+ // it but don't provide FlashWindowEx() declaration
+#if (WINVER >= 0x0500 && (defined FLASHW_STOP))
+ // available in the headers, check if it is supported by the system
+ typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi);
+ FlashWindowEx_t s_pfnFlashWindowEx = NULL;
+ if ( !s_pfnFlashWindowEx )
+ {
+ wxDynamicLibrary dllUser32(_T("user32.dll"));
+ s_pfnFlashWindowEx = (FlashWindowEx_t)
+ dllUser32.GetSymbol(_T("FlashWindowEx"));
+
+ // we can safely unload user32.dll here, it's goign to remain loaded as
+ // long as the program is running anyhow
+ }
+
+ if ( s_pfnFlashWindowEx )
+ {
+ WinStruct<FLASHWINFO> fwi;
+ fwi.hwnd = GetHwnd();
+ fwi.dwFlags = FLASHW_ALL;
+ if ( flags & wxUSER_ATTENTION_INFO )
+ {
+ // just flash a few times
+ fwi.uCount = 3;
+ }
+ else // wxUSER_ATTENTION_ERROR
+ {
+ // flash until the user notices it
+ fwi.dwFlags |= FLASHW_TIMERNOFG;
+ }
+
+ s_pfnFlashWindowEx(&fwi);
+ }
+ else // FlashWindowEx() not available
+#endif // FlashWindowEx() defined
+ {
+ wxUnusedVar(flags);
+#ifndef __WXWINCE__
+ ::FlashWindow(GetHwnd(), TRUE);
+#endif // __WXWINCE__
+ }