Click here to Skip to main content
15,916,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: InvertRgn Pin
Mark Salsbery26-Nov-07 8:47
Mark Salsbery26-Nov-07 8:47 
GeneralRe: InvertRgn Pin
bob1697226-Nov-07 8:56
bob1697226-Nov-07 8:56 
GeneralRe: InvertRgn Pin
Mark Salsbery26-Nov-07 9:02
Mark Salsbery26-Nov-07 9:02 
GeneralRe: InvertRgn Pin
bob1697226-Nov-07 9:20
bob1697226-Nov-07 9:20 
GeneralRe: InvertRgn Pin
bob1697226-Nov-07 10:48
bob1697226-Nov-07 10:48 
GeneralRe: InvertRgn Pin
Mark Salsbery26-Nov-07 12:53
Mark Salsbery26-Nov-07 12:53 
GeneralRe: InvertRgn Pin
bob1697226-Nov-07 18:44
bob1697226-Nov-07 18:44 
GeneralRe: InvertRgn Pin
Mark Salsbery27-Nov-07 7:18
Mark Salsbery27-Nov-07 7:18 
bob16972 wrote:
It uses the HDC before the graphics object goes out of scope. (Shame on them);)


That MAY actually be OK, since the Graphics object is wrapping an already-existing
HDC.  The only thing the docs state about that situation is:

"When you use this constructor to create a Graphics object, make sure that the Graphics
object is deleted or goes out of scope before the device context is released.
"

The other situation, getting an HDC from a Graphics object with Graphics::GetHDC() is more
restrictive:

"Do not call any methods of the Graphics object between the calls to GetHDC and ReleaseHDC."

I'm not sure how the Graphics class deals with HDCs internally, but I imagine when you pass an
already-created HDC into the Graphics class constructor, it just uses the DC you pass in - the
creator still "owns" the DC.

If you let the Graphics class create its own DC, however, it "owns" the DC, and the DC it gives
you through GetHDC may be a temporary copy.

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: InvertRgn Pin
bob1697227-Nov-07 9:48
bob1697227-Nov-07 9:48 
GeneralRe: InvertRgn Pin
Mark Salsbery27-Nov-07 9:57
Mark Salsbery27-Nov-07 9:57 
GeneralRe: InvertRgn Pin
bob1697227-Nov-07 10:10
bob1697227-Nov-07 10:10 
GeneralRe: InvertRgn Pin
Mark Salsbery27-Nov-07 10:50
Mark Salsbery27-Nov-07 10:50 
QuestionLoad dll's Pin
Anthony Mushrow26-Nov-07 8:41
professionalAnthony Mushrow26-Nov-07 8:41 
AnswerRe: Load dll's Pin
Mark Salsbery26-Nov-07 8:44
Mark Salsbery26-Nov-07 8:44 
GeneralRe: Load dll's Pin
Anthony Mushrow26-Nov-07 8:49
professionalAnthony Mushrow26-Nov-07 8:49 
Questionnumber of open files limit Pin
Joezer BH26-Nov-07 8:08
professionalJoezer BH26-Nov-07 8:08 
AnswerRe: number of open files limit Pin
Mark Salsbery26-Nov-07 8:30
Mark Salsbery26-Nov-07 8:30 
AnswerRe: number of open files limit Pin
Stephen Hewitt26-Nov-07 13:08
Stephen Hewitt26-Nov-07 13:08 
QuestionTemplate function returning a variable of type T Pin
racette26-Nov-07 7:22
racette26-Nov-07 7:22 
AnswerRe: Template function returning a variable of type T Pin
Cedric Moonen26-Nov-07 7:28
Cedric Moonen26-Nov-07 7:28 
GeneralRe: Template function returning a variable of type T Pin
racette26-Nov-07 10:09
racette26-Nov-07 10:09 
QuestionGet_url: Firefox? Pin
Gofur Halmurat26-Nov-07 6:35
Gofur Halmurat26-Nov-07 6:35 
QuestionRe: Get_url: Firefox? Pin
David Crow26-Nov-07 7:23
David Crow26-Nov-07 7:23 
AnswerRe: Get_url: Firefox? Pin
Gofur Halmurat26-Nov-07 7:50
Gofur Halmurat26-Nov-07 7:50 
GeneralRe: Get_url: Firefox? Pin
ThatsAlok26-Nov-07 18:45
ThatsAlok26-Nov-07 18:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.