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

C / C++ / MFC

 
GeneralRe: Multithread and GDI Issues Pin
kanduripavan9-Mar-08 2:26
kanduripavan9-Mar-08 2:26 
GeneralRe: Multithread and GDI Issues Pin
Cedric Moonen9-Mar-08 2:34
Cedric Moonen9-Mar-08 2:34 
GeneralRe: Multithread and GDI Issues Pin
kanduripavan9-Mar-08 2:49
kanduripavan9-Mar-08 2:49 
GeneralRe: Multithread and GDI Issues Pin
kanduripavan10-Mar-08 0:08
kanduripavan10-Mar-08 0:08 
GeneralRe: Multithread and GDI Issues Pin
Rajkumar R10-Mar-08 0:46
Rajkumar R10-Mar-08 0:46 
GeneralRe: Multithread and GDI Issues Pin
Mark Salsbery9-Mar-08 8:58
Mark Salsbery9-Mar-08 8:58 
GeneralRe: Multithread and GDI Issues Pin
kanduripavan10-Mar-08 0:18
kanduripavan10-Mar-08 0:18 
GeneralRe: Multithread and GDI Issues Pin
Mark Salsbery10-Mar-08 6:52
Mark Salsbery10-Mar-08 6:52 
kanduripavan wrote:
1.The critical section is initialized by the UI Thread ie by the primary thread. So is it there it can go wrong.


Any thread can initialize it, as long as it's initialized before a thread tries to use it.

kanduripavan wrote:
consider the handle as a shared object
which is inside the critcal section


This is only a logical way to think about it.  In reality, there's no protection of the handle by the critical section.
What the critical section does is prevent execution of code by a thread until another thread owning the critical section
releases the critical section.  This can be used to prevent two threads from using/changing the same handle/variable/data or
any other resource shared by multiple threads.  Critical sections can also be used just to prevent two threads from
executing the same code simultaneously - there doesn't have to be any data or other resource involved.


kanduripavan wrote:
The assertion is shown in GDI files


You have the source code - what's the line of code??

Using MFC may not work for what you're doing, since MFC has internal containers that are thread-specific.
To get around this, you can use an HDC directly instead of through the CDC and derived classes.

Mark




Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Multithread and GDI Issues Pin
Mark Salsbery10-Mar-08 6:55
Mark Salsbery10-Mar-08 6:55 
GeneralRe: Multithread and GDI Issues Pin
kanduripavan11-Mar-08 8:12
kanduripavan11-Mar-08 8:12 
QuestionHow can I get the mouse position when i click on the CListCtrl? Pin
Md. Ali Naser Khan8-Mar-08 18:00
Md. Ali Naser Khan8-Mar-08 18:00 
AnswerRe: How can I get the mouse position when i click on the CListCtrl? Pin
Md. Ali Naser Khan8-Mar-08 19:48
Md. Ali Naser Khan8-Mar-08 19:48 
GeneralRe: How can I get the mouse position when i click on the CListCtrl? Pin
Rajkumar R8-Mar-08 21:28
Rajkumar R8-Mar-08 21:28 
GeneralCSpinButton event handling Pin
Tom Paronis8-Mar-08 10:16
Tom Paronis8-Mar-08 10:16 
GeneralRe: CSpinButton event handling Pin
Mark Salsbery8-Mar-08 10:21
Mark Salsbery8-Mar-08 10:21 
GeneralRe: CSpinButton event handling Pin
Tom Paronis8-Mar-08 10:27
Tom Paronis8-Mar-08 10:27 
GeneralRe: CSpinButton event handling Pin
Mark Salsbery8-Mar-08 11:30
Mark Salsbery8-Mar-08 11:30 
GeneralRe: CSpinButton event handling Pin
Tom Paronis9-Mar-08 8:31
Tom Paronis9-Mar-08 8:31 
GeneralRe: CSpinButton event handling Pin
Mark Salsbery9-Mar-08 8:43
Mark Salsbery9-Mar-08 8:43 
GeneralRadio Buttons Pin
RomTibi8-Mar-08 9:02
RomTibi8-Mar-08 9:02 
GeneralRe: Radio Buttons Pin
Christian Graus8-Mar-08 14:25
protectorChristian Graus8-Mar-08 14:25 
GeneralRe: Radio Buttons Pin
RomTibi8-Mar-08 23:47
RomTibi8-Mar-08 23:47 
GeneralRe: Radio Buttons Pin
Hamid_RT9-Mar-08 0:46
Hamid_RT9-Mar-08 0:46 
GeneralRe: Radio Buttons Pin
RomTibi9-Mar-08 8:25
RomTibi9-Mar-08 8:25 
GeneralRe: Radio Buttons Pin
Hamid_RT9-Mar-08 19:52
Hamid_RT9-Mar-08 19:52 

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.