Re: BitBlt failing under XP with a locked screen saver

From: Christopher Bohn (cbohn_at_nospammingrrinc.com)
Date: 03/04/04


Date: Thu, 04 Mar 2004 10:52:09 -0500

What is the best approach to determine what the active desktop actually
is to determine if my app's desktop is active. If the app's desktop is
active, it is a real error I need to handle. If the app's desktop isn't
active (e.g., locked screen saver running in its own desktop), then I
can ignore the error. I have searched some groups and found approaches
that do things like:

HDESK threaddesktop = GetThreadDesktop(GetCurrentThreadId());
HDESK inputdesktop = OpenInputDesktop(...)

then get the name of each desktop through the GetUserObjectInformation
call, and then compare the names to see if they are the same. That
doesn't seem like a great approach, but after looking more, I don't see
many other choices. It would be nice if there was a simple way to get
the name of the active desktop (in which case, if it wasn't the input
desktop, as seen from OpenInputDesktop, then I could know the input
desktop wasn't active).

I haven't tried the example method indicated above yet, but it seemed
like GetThreadDesktop(GetCurrentThreadId()) would always return the
input desktop because the app is started on it, and I wouldn't think the
thread would change desktops just because a locked screen saver starts.

Chris

Rhett Gong [MSFT] wrote:

> Hi Dave,
> I am succeeded to repro it in my xp machine. It looks like the same problem with Chris.
> From my test, it returns ERROR_ACCESS_DENIED. Based on my search, It seems that most native applications ignore GDI errors so they never cause this problem.
> :(
>
> I agree with Chris that it should have an error named ERROR_NOT_AN_ACTIVE_DESKTOP_SO_CANT_DRAW, since it won't be drawn if the DC is not on an
> active desktop.
>
> One possible resolution is to catch and ignore this error in your app. I know this is not really a good approach, because there really is an error which could be
> handled earlier in the code path. Thanks for your understanding.
>
> Hope this helps.
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Please reply to newsgroups only. Thanks.



Relevant Pages

  • Re: Runtime and MDAC problem
    ... Thanks Chris! ... I'm just trying to install a miserable 1.300 euros ... The Windows Runtime application "opens" requesting the app password, ... wait for MS reaction, call Gates on his mob ?? ...
    (microsoft.public.access.developers.toolkitode)
  • Re: WebResponse.Close() not disposing unmanaged resource?
    ... Hi Chris, ... > and it appears to be leaking memory. ... > wrote this code in a test app to try duplicating ... Checking the profiler, I ...
    (microsoft.public.dotnet.framework)
  • Re: Access 95 to 2003
    ... Chris, I can't follow your reply at all ... Firstly, the question was about a Visual Basic app, using an A95 db ... use in A2003, see the suggestions for setup, conversion, and usability in: ... so such a general question is a little unfair to ask. ...
    (microsoft.public.access.conversion)
  • Re: Determining whether a document is open
    ... > Thanks Chris. ... > for MS Word and Excel. ... > Macmillan described where the app closes the disk file after loading ... > app like Notepad, ...
    (borland.public.delphi.language.objectpascal)