Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:10
kelprinc16-Jan-06 22:10 
AnswerRe: Share names Pin
vallikumar16-Jan-06 22:23
vallikumar16-Jan-06 22:23 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:28
kelprinc16-Jan-06 22:28 
AnswerRe: Share names Pin
_AnsHUMAN_ 16-Jan-06 22:29
_AnsHUMAN_ 16-Jan-06 22:29 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:34
kelprinc16-Jan-06 22:34 
AnswerRe: Share names Pin
David Crow17-Jan-06 4:28
David Crow17-Jan-06 4:28 
QuestionQuery related to Worker Threads & GUI Window? Pin
dp_7616-Jan-06 20:28
dp_7616-Jan-06 20:28 
AnswerRe: Query related to Worker Threads & GUI Window? Pin
Roger Stoltz16-Jan-06 21:37
Roger Stoltz16-Jan-06 21:37 
dp_76 wrote:
Q1--> Is the above strategy fine?


This is the same thing as manipulating GUI objects from a worker thread since a ::SendMessage is issued in both cases. When using ::SendMessage the call will wait for the message to be handled before returning. If the receiving thread does not handle the message you will have a deadlock situation.
Even if you are fortunate and able to avoid a deadlock situation, your worker thread is waiting for the main thread to handle the message and your worker thread is "paused" until the main thread has handled the message. Usually this is not desired.
The use of ::PostMessage is recommended instead which will prevent a deadlock situation and also makes the worker thread continue while the main thread is handling the messages you've posted to it.

Regarding the message box issue the same thing as above is applicable.
If you are using ::SendMessage, the worker thread would be waiting for the call to return and here you may have a deadlock situation if you like to wait for the worker thread to finish by waiting on the thread handle.

The thing is do have a worker thread execute asynchronously as long as it does not use data that is shared between thread. If either thread is using shared data you would need some kind of synchronization object to prevent data corruption, e.g. critical section.

Hope this helps
--
Roger


It's supposed to be hard, otherwise anybody could do it!
Answer[Message Deleted] Pin
Stephen Hewitt16-Jan-06 21:47
Stephen Hewitt16-Jan-06 21:47 
AnswerRe: Query related to Worker Threads & GUI Window? Pin
Stephen Hewitt16-Jan-06 21:47
Stephen Hewitt16-Jan-06 21:47 
Questionhow to convert the HTML files output to the image like bitmap or jpg Pin
Hemant kulkarni16-Jan-06 20:26
Hemant kulkarni16-Jan-06 20:26 
AnswerRe: how to convert the HTML files output to the image like bitmap or jpg Pin
kelprinc16-Jan-06 20:44
kelprinc16-Jan-06 20:44 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Hemant kulkarni16-Jan-06 21:14
Hemant kulkarni16-Jan-06 21:14 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Stephen Hewitt16-Jan-06 22:06
Stephen Hewitt16-Jan-06 22:06 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Stephen Hewitt16-Jan-06 23:00
Stephen Hewitt16-Jan-06 23:00 
AnswerRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Owner drawn16-Jan-06 22:15
Owner drawn16-Jan-06 22:15 
AnswerRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Stephen Hewitt16-Jan-06 23:08
Stephen Hewitt16-Jan-06 23:08 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Hemant kulkarni16-Jan-06 23:30
Hemant kulkarni16-Jan-06 23:30 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Anamika200518-May-06 20:10
Anamika200518-May-06 20:10 
GeneralRe: how to convert the HTML files output to the image like bitmap or jpg Pin
Stephen Hewitt18-May-06 20:14
Stephen Hewitt18-May-06 20:14 
AnswerRe: how to convert the HTML files output to the image like bitmap or jpg Pin
vikas amin17-Jan-06 0:51
vikas amin17-Jan-06 0:51 
QuestionSend mouse message Pin
leenmie16-Jan-06 19:47
leenmie16-Jan-06 19:47 
AnswerRe: Send mouse message Pin
Rajesh R Subramanian16-Jan-06 19:54
professionalRajesh R Subramanian16-Jan-06 19:54 
AnswerRe: Send mouse message Pin
Stephen Hewitt16-Jan-06 19:55
Stephen Hewitt16-Jan-06 19:55 
AnswerRe: Send mouse message Pin
Owner drawn16-Jan-06 19:56
Owner drawn16-Jan-06 19:56 

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.