Another attempt of a test for a visible desktop.

diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index 02e813f..f75035d 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -4,7 +4,7 @@
 VPATH     = @srcdir@
 MODULE    = winetest.exe
 APPMODE   = -mconsole
-IMPORTS   = comctl32 user32 wsock32
+IMPORTS   = comctl32 user32 gdi32 wsock32
 
 C_SRCS = \
 	gui.c \
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 9bcfd6e..5f4b293 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -68,7 +68,23 @@
 
 static int running_on_visible_desktop ()
 {
-    return IsWindowVisible( GetDesktopWindow() );
+    BOOL visible;
+    HWND desktop;
+    HDC hdc;
+    HRGN hrgn;
+    RECT rc;
+
+    desktop = GetDesktopWindow();
+    hdc = GetDC(desktop);
+    hrgn = CreateRectRgn(0, 0, 0, 0);
+    GetRandomRgn(hdc, hrgn, SYSRGN);
+
+    visible = GetRgnBox(hrgn, &rc) != NULLREGION;
+
+    DeleteObject(hrgn);
+    ReleaseDC(desktop, hdc);
+
+    return visible;
 }
 
 void print_version ()