Fast User Switching triggers "Access is Denied" for StretchBlt()

  • Thread starter Thread starter Al Koch
  • Start date Start date
A

Al Koch

Hello,

I have a problem with a StretchBlt() that is failing on an XP system w/Fast
User Switching.

The StretchBlt() is part of an Owner Draw routine that draws custom buttons
on dialog boxes. This code has worked for a decade on earlier versions of
Windows. Further, the code works just fine on XP until I use Fast User
Switching to leave the current (Admin) user account with my application and
a dialog box that depends on WM_OWNERDRAW to draw its custom buttons
displayed. As I said, StretchBlt() draws the buttons correctly on all these
dialog boxes. But if I switch away, as soon as I switch back to the
original user, StretchBlt() fails with Win32 Error = 5 and the associated
error message "Access is Denied".

The only thing (other than memory) that I'm accessing is the screen. Is
something under XP preventing access to the screen? If so, why is this only
happening upon return from a Fast user Switch? This sure looks like a bug
but I can't find a reference to it anywhere on the Net!

Is anyone familiar with this problem?

Thanks,
Al
 
Hi Mark,

Thanks *VERY MUCH* for pointing me to that URL (how in the world did you
find that one?).

I'm just guessing, but it appears to me that this is a bug and that XP is
sending my application a WM_OWNERDRAW message *BEFORE* it has "unlocked the
window/session"! I'm now using GetForegroundWindow() to let me skip that
initial redraw when we 1st switch back to the session, but I sure wish I
knew what the problem really was. Thanks again.

Al
 
Hi Mark,

It seems that my previous reply to you was not posted (so I'll try again)!

Thanks very much for pointing me to the URL. That at least gave me a
workaround but I'd sure like to know what's going on. (How in the world did
you find that posting?)

Thanks again,
Al
 
Hi Mark,

This is my 3rd attempt to reply to you! They don't show up in the list of
posts.

I just wanted to thank you for pointng me to that URL. Plus I was curious
how in the world you found it.

Thanks again,
Al
 
I can see al three now.
I now its only a workaround, but thats all I could find out about it.
I used google to trace it.

Regards
Mark Dormer
 
Back
Top