Click here to Skip to main content
16,003,417 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGDI+ initialization Pin
indigox316-Oct-07 9:16
indigox316-Oct-07 9:16 
AnswerRe: GDI+ initialization Pin
led mike16-Oct-07 9:43
led mike16-Oct-07 9:43 
GeneralRe: GDI+ initialization Pin
indigox316-Oct-07 9:53
indigox316-Oct-07 9:53 
GeneralRe: GDI+ initialization Pin
led mike17-Oct-07 4:44
led mike17-Oct-07 4:44 
AnswerRe: GDI+ initialization Pin
Mark Salsbery16-Oct-07 9:58
Mark Salsbery16-Oct-07 9:58 
GeneralRe: GDI+ initialization Pin
indigox317-Oct-07 3:41
indigox317-Oct-07 3:41 
GeneralRe: GDI+ initialization Pin
led mike17-Oct-07 4:43
led mike17-Oct-07 4:43 
AnswerRe: GDI+ initialization Pin
Randor 16-Oct-07 10:28
professional Randor 16-Oct-07 10:28 
Thanks for the question, I did not know the answer and I was curious myself so I took the liberty of investigating.

My first clue was in the MSDN
It says: Each call to GdiplusStartup should be paired with a call to GdiplusShutdown.

http://msdn2.microsoft.com/en-us/library/ms534076.aspx[^]

So I fired up IDA Pro and began dissassembling gdiplus.dll to have a look at the op-codes. I always want to know whats really going on.

Indeed, it appears each call to GdiplusStartup results in the critical section wrapped incrementing of a reference counter. Subsequently each call to GdiplusShutdown performs the opposite with the decrementing of the reference counter dword_7A20A040. Cleanup of the objects does not appear to take place until the reference count is zero.

So it seems it is indeed safe to call GdiplusStartup/GdiplusShutdown in parallel between threads, and even within the same thread. As long as each GdiplusStartup is followed by a GdiplusShutdown.

Best Wishes,
-Randor (David Delaune)
GeneralRe: GDI+ initialization Pin
Mark Salsbery16-Oct-07 10:31
Mark Salsbery16-Oct-07 10:31 
GeneralRe: GDI+ initialization Pin
indigox317-Oct-07 3:38
indigox317-Oct-07 3:38 
QuestionProblem on MM_HIMETRIC mode with different video cards Pin
JibJeab16-Oct-07 6:12
JibJeab16-Oct-07 6:12 
AnswerRe: Problem on MM_HIMETRIC mode with different video cards Pin
Iain Clarke, Warrior Programmer17-Oct-07 5:36
Iain Clarke, Warrior Programmer17-Oct-07 5:36 
QuestionPrint an image file on default printer from c++ application Pin
ShilpaPotnis16-Oct-07 5:27
ShilpaPotnis16-Oct-07 5:27 
AnswerRe: Print an image file on default printer from c++ application Pin
led mike16-Oct-07 5:46
led mike16-Oct-07 5:46 
GeneralRe: Print an image file on default printer from c++ application Pin
ShilpaPotnis16-Oct-07 5:54
ShilpaPotnis16-Oct-07 5:54 
GeneralRe: Print an image file on default printer from c++ application Pin
led mike16-Oct-07 6:05
led mike16-Oct-07 6:05 
GeneralRe: Print an image file on default printer from c++ application Pin
ShilpaPotnis16-Oct-07 6:12
ShilpaPotnis16-Oct-07 6:12 
QuestionHow do you set the text color for a static label? Pin
littleGreenDude16-Oct-07 5:14
littleGreenDude16-Oct-07 5:14 
QuestionRe: How do you set the text color for a static label? Pin
David Crow16-Oct-07 5:21
David Crow16-Oct-07 5:21 
AnswerRe: How do you set the text color for a static label? Pin
littleGreenDude16-Oct-07 5:43
littleGreenDude16-Oct-07 5:43 
GeneralRe: How do you set the text color for a static label? Pin
David Crow16-Oct-07 5:52
David Crow16-Oct-07 5:52 
GeneralRe: How do you set the text color for a static label? Pin
littleGreenDude16-Oct-07 6:13
littleGreenDude16-Oct-07 6:13 
GeneralRe: How do you set the text color for a static label? Pin
David Crow16-Oct-07 6:20
David Crow16-Oct-07 6:20 
Questionhow to read txt file Pin
nomi khan16-Oct-07 5:11
nomi khan16-Oct-07 5:11 
QuestionRe: how to read txt file Pin
David Crow16-Oct-07 5:18
David Crow16-Oct-07 5:18 

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.