Commit 454c1b75 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Implement a test for the desktop visibility based on the MSDN article

pointed out by Robert Shearman.
parent af54602c
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
...@@ -68,23 +69,21 @@ static int running_under_wine () ...@@ -68,23 +69,21 @@ static int running_under_wine ()
static int running_on_visible_desktop () static int running_on_visible_desktop ()
{ {
BOOL visible; FARPROC pGetProcessWindowStation = GetProcAddress(GetModuleHandle("user32.dll"), "GetProcessWindowStation");
HWND desktop;
HDC hdc;
HRGN hrgn;
RECT rc;
desktop = GetDesktopWindow(); if (pGetProcessWindowStation)
hdc = GetDC(desktop); {
hrgn = CreateRectRgn(0, 0, 0, 0); DWORD len;
GetRandomRgn(hdc, hrgn, SYSRGN); HWINSTA wstation;
USEROBJECTFLAGS uoflags;
visible = GetRgnBox(hrgn, &rc) != NULLREGION; FARPROC pGetUserObjectInformationA = GetProcAddress(GetModuleHandle("user32.dll"), "GetUserObjectInformationA");
DeleteObject(hrgn); wstation = (HWINSTA)pGetProcessWindowStation();
ReleaseDC(desktop, hdc); assert(pGetUserObjectInformationA(wstation, UOI_FLAGS, &uoflags, sizeof(uoflags), &len));
return (uoflags.dwFlags & WSF_VISIBLE) != 0;
return visible; }
else
return IsWindowVisible(GetDesktopWindow());
} }
void print_version () void print_version ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment