Click here to Skip to main content
15,899,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Service problem Pin
David Crow20-Jun-07 6:55
David Crow20-Jun-07 6:55 
GeneralRe: Service problem Pin
led mike20-Jun-07 7:09
led mike20-Jun-07 7:09 
GeneralRe: Service problem Pin
David Crow20-Jun-07 7:18
David Crow20-Jun-07 7:18 
GeneralRe: Service problem Pin
Mark Salsbery20-Jun-07 7:24
Mark Salsbery20-Jun-07 7:24 
GeneralRe: Service problem Pin
Matthew Faithfull20-Jun-07 7:53
Matthew Faithfull20-Jun-07 7:53 
GeneralRe: Service problem Pin
Mark Salsbery20-Jun-07 8:53
Mark Salsbery20-Jun-07 8:53 
QuestionA thread problem Pin
iayd20-Jun-07 2:59
iayd20-Jun-07 2:59 
AnswerRe: A thread problem Pin
Matthew Faithfull20-Jun-07 3:42
Matthew Faithfull20-Jun-07 3:42 
If you're working in MFC then there is a simple rule.

Never do anything in a worker thread that touches the user interface directly in any way. Not even a message box. (Even if it seems to work most of the time)

If you want to change the UI from a worker thread then use PostMessage to tell your main thread to do it and then get the main thread to change the UI in the message handler. You can define your own mesages in the WM_USER + n range for these sort of things and add ON_MESSAGE entries to your message maps to route to your handler.

The reason for this overly strict sounding rule is that MFC blocks the main thread anyway when it does anything UI related even if you call the MFC functions from your worker thread. If the main thread is waiting for the worker to complete but the worker is waiting for MFC to grab the main thread to change the UI nothing will ever happen. This receipe for deadlocks should be avoided by all non masochists Big Grin | :-D

Nothing is exactly what it seems but everything with seems can be unpicked.

GeneralRe: A thread problem Pin
iayd20-Jun-07 4:12
iayd20-Jun-07 4:12 
GeneralRe: A thread problem Pin
JudyL_MD21-Jun-07 2:32
JudyL_MD21-Jun-07 2:32 
AnswerRe: A thread problem Pin
Roger Stoltz20-Jun-07 4:04
Roger Stoltz20-Jun-07 4:04 
QuestionVisualization and Modelling Tools Pin
od@ananzi.co.za20-Jun-07 2:11
od@ananzi.co.za20-Jun-07 2:11 
AnswerRe: Visualization and Modelling Tools Pin
led mike20-Jun-07 5:16
led mike20-Jun-07 5:16 
GeneralRe: Visualization and Modelling Tools Pin
Matthew Faithfull20-Jun-07 23:41
Matthew Faithfull20-Jun-07 23:41 
GeneralRe: Visualization and Modelling Tools Pin
od@ananzi.co.za21-Jun-07 2:27
od@ananzi.co.za21-Jun-07 2:27 
QuestionProblem in deleting the windows registery key and it's sub key Pin
Neeraj Sinha20-Jun-07 2:06
Neeraj Sinha20-Jun-07 2:06 
AnswerRe: Problem in deleting the windows registery key and it's sub key Pin
Mike Dimmick20-Jun-07 2:40
Mike Dimmick20-Jun-07 2:40 
GeneralRe: Problem in deleting the windows registery key and it's sub key Pin
Neeraj Sinha20-Jun-07 3:33
Neeraj Sinha20-Jun-07 3:33 
Questionveryurgent : perfect tool to convert coff format lib to omf format Pin
rjkg20-Jun-07 2:00
rjkg20-Jun-07 2:00 
AnswerRe: veryurgent : perfect tool to convert coff format lib to omf format Pin
toxcct20-Jun-07 2:06
toxcct20-Jun-07 2:06 
GeneralRe: veryurgent : perfect tool to convert coff format lib to omf format Pin
rjkg20-Jun-07 2:20
rjkg20-Jun-07 2:20 
AnswerRe: veryurgent : perfect tool to convert coff format lib to omf format Pin
Mark Salsbery20-Jun-07 5:40
Mark Salsbery20-Jun-07 5:40 
JokeRe: veryurgent : perfect tool to convert coff format lib to omf format Pin
Hamid_RT20-Jun-07 9:24
Hamid_RT20-Jun-07 9:24 
GeneralRe: veryurgent : perfect tool to convert coff format lib to omf format Pin
Mark Salsbery20-Jun-07 9:26
Mark Salsbery20-Jun-07 9:26 
QuestionCSocket stoping in PumpMessage (please help) Pin
tomitron20-Jun-07 1:55
tomitron20-Jun-07 1:55 

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.