Click here to Skip to main content
15,913,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OnCtlColor Pin
KarstenK27-Jun-07 23:12
mveKarstenK27-Jun-07 23:12 
AnswerRe: OnCtlColor Pin
alias_rizwan28-Jun-07 0:26
alias_rizwan28-Jun-07 0:26 
QuestionThread Question Pin
Programm3r27-Jun-07 20:47
Programm3r27-Jun-07 20:47 
AnswerRe: Thread Question Pin
KarstenK27-Jun-07 20:57
mveKarstenK27-Jun-07 20:57 
GeneralRe: Thread Question Pin
Programm3r27-Jun-07 21:00
Programm3r27-Jun-07 21:00 
AnswerRe: Thread Question Pin
Cedric Moonen27-Jun-07 21:16
Cedric Moonen27-Jun-07 21:16 
QuestionRe: Thread Question Pin
Programm3r27-Jun-07 22:02
Programm3r27-Jun-07 22:02 
AnswerRe: Thread Question Pin
Roger Stoltz27-Jun-07 21:55
Roger Stoltz27-Jun-07 21:55 
There are two common ways:

  1. With a UI-thread you post a message with the information you want to pass to the thread
  2. With a worker thread (like your example) you have a place where the thread knows it can find information, such as a queue, a struct on the heap or class member variables. When the thread is supposed to get the new information you signal an event or semaphore that the thread is waiting on with ::WaitForMultipleObjects(...).

Don't forget to synchronize the threads to avoid data corruption.

For more info on workerthreads, read this article[^].
For more info on semaphores and queues between workerthreads, read this article[^].

You will find a third alternative with I/O completion ports here[^]. The article also discuss when thread synchronization isn't needed, or could be avoided.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown

GeneralRe: Thread Question Pin
Programm3r27-Jun-07 22:03
Programm3r27-Jun-07 22:03 
QuestionMulti threading in c++ Pin
role127-Jun-07 20:27
role127-Jun-07 20:27 
QuestionStreach or skew a bitmap to fit to resizing button size Pin
robshere27-Jun-07 20:06
robshere27-Jun-07 20:06 
AnswerRe: Streach or skew a bitmap to fit to resizing button size Pin
KarstenK27-Jun-07 20:53
mveKarstenK27-Jun-07 20:53 
QuestionRe: You need a ownerdrawn Button Pin
robshere29-Jun-07 2:00
robshere29-Jun-07 2:00 
AnswerRe: You need a ownerdrawn Button Pin
KarstenK29-Jun-07 2:18
mveKarstenK29-Jun-07 2:18 
QuestionHelp Needed !!! Pin
SelvaKr27-Jun-07 18:28
SelvaKr27-Jun-07 18:28 
AnswerRe: Help Needed !!! Pin
JudyL_MD28-Jun-07 2:38
JudyL_MD28-Jun-07 2:38 
GeneralRe: Help Needed !!! Pin
SelvaKr28-Jun-07 19:17
SelvaKr28-Jun-07 19:17 
GeneralRe: Help Needed !!! Pin
JudyL_MD29-Jun-07 2:27
JudyL_MD29-Jun-07 2:27 
QuestionHow to close a user created message box without effecting the background Pin
msr_codeproject27-Jun-07 18:26
msr_codeproject27-Jun-07 18:26 
AnswerRe: How to close a user created message box without effecting the background Pin
Joan M27-Jun-07 18:58
professionalJoan M27-Jun-07 18:58 
Questionunit testing Pin
deeps_cute27-Jun-07 17:55
deeps_cute27-Jun-07 17:55 
AnswerRe: unit testing Pin
_AnsHUMAN_ 27-Jun-07 20:05
_AnsHUMAN_ 27-Jun-07 20:05 
Questioncannot open include file 'afxres.h' Pin
gentleguy27-Jun-07 17:31
gentleguy27-Jun-07 17:31 
AnswerRe: cannot open include file 'afxres.h' Pin
spsharma27-Jun-07 22:51
spsharma27-Jun-07 22:51 
QuestionGettings error strings from Winerror.h Pin
Akin Ocal27-Jun-07 12:51
Akin Ocal27-Jun-07 12:51 

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.