Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to change the scan code while posting WM_KEYDOWN and WM_KEYUP messages? Pin
Christopher Lloyd3-Feb-05 1:23
Christopher Lloyd3-Feb-05 1:23 
GeneralRe: How to change the scan code while posting WM_KEYDOWN and WM_KEYUP messages? Pin
Blake Miller3-Feb-05 6:03
Blake Miller3-Feb-05 6:03 
QuestionHow to corelate VC++ data to EXCElL sheet Pin
Member 9009872-Feb-05 17:56
Member 9009872-Feb-05 17:56 
AnswerRe: How to corelate VC++ data to EXCElL sheet Pin
tigron2-Feb-05 18:28
tigron2-Feb-05 18:28 
AnswerRe: How to corelate VC++ data to EXCElL sheet Pin
David Crow3-Feb-05 3:12
David Crow3-Feb-05 3:12 
GeneralThreaded Concept Question Pin
LighthouseJ2-Feb-05 16:53
LighthouseJ2-Feb-05 16:53 
GeneralRe: Threaded Concept Question Pin
LighthouseJ2-Feb-05 18:13
LighthouseJ2-Feb-05 18:13 
GeneralRe: Threaded Concept Question Pin
rwestgraham2-Feb-05 19:13
rwestgraham2-Feb-05 19:13 
Writing a threaded application that utilizes a single worker thread performing essentially a single task and communicating with a parent thread is not all that difficult.

Multithreading becomes tricky, at least in my opinion, mostly when you start having to use CriticalSections, which can be very subtle in terms of debugging.

But for what you describe, I think you can accomplish it with some fairly simple synchronization tools that are predictable and not so prone to the subtle intermittant errors CriticalSections can cause.

Read up a little on thread synchronization primitives. Each has it's various merits and uses.

Here are some of the families that I think you will find useful in the app you described:

Mutexes/Semaphores are used in combination to provide a reliable way to synchronize threads' read/write access to common data to prevent access violations.

InterlockedIncrement and related Interlocked APIs provide inherently threadsafe and utterly simple to implement methods to toggle a shared boolean, increment/decrement a count variable shared by two threads, etc. For example, a parent thread telling a worker thread to cancel a task is as simple as declare an integer, have the parent increment it to signal a cancel, and have a worker thread check the value periodically.

CreateEvent/PulseEvent provide a way for one thread to start and stop another thread that needs to execute code in a continuous loop, or execute a single task repeatedly, but only after being signaled by the parent.

And so forth.

That should give you plenty of ideas to start with ...

Robert
GeneralRe: Threaded Concept Question Pin
LighthouseJ3-Feb-05 2:34
LighthouseJ3-Feb-05 2:34 
GeneralRe: Threaded Concept Question Pin
Blake Miller3-Feb-05 6:18
Blake Miller3-Feb-05 6:18 
GeneralDetecting fullscreen apps Pin
Anonymous2-Feb-05 16:51
Anonymous2-Feb-05 16:51 
GeneralTired of this problem Pin
pc_dev2-Feb-05 16:42
pc_dev2-Feb-05 16:42 
GeneralMFC help PLEASE!! Pin
messin182-Feb-05 14:19
messin182-Feb-05 14:19 
GeneralRe: MFC help PLEASE!! Pin
Bob Ciora2-Feb-05 14:31
Bob Ciora2-Feb-05 14:31 
GeneralRe: MFC help PLEASE!! Pin
messin182-Feb-05 18:10
messin182-Feb-05 18:10 
GeneralRe: MFC help PLEASE!! Pin
Bob Ciora3-Feb-05 1:53
Bob Ciora3-Feb-05 1:53 
General3D in a dialog... Pin
Bob Ciora3-Feb-05 3:33
Bob Ciora3-Feb-05 3:33 
GeneralRe: 3D in a dialog... Pin
Anonymous3-Feb-05 7:53
Anonymous3-Feb-05 7:53 
GeneralRe: 3D in a dialog... Pin
Bob Ciora3-Feb-05 11:31
Bob Ciora3-Feb-05 11:31 
GeneralRe: MFC help PLEASE!! Pin
Rick York3-Feb-05 7:28
mveRick York3-Feb-05 7:28 
GeneralRe: MFC help PLEASE!! Pin
Bob Ciora3-Feb-05 11:35
Bob Ciora3-Feb-05 11:35 
GeneralRe: MFC help PLEASE!! Pin
messin183-Feb-05 17:28
messin183-Feb-05 17:28 
GeneralRe: MFC help PLEASE!! Pin
Bob Ciora4-Feb-05 1:44
Bob Ciora4-Feb-05 1:44 
GeneralRe: MFC help PLEASE!! Pin
messin187-Feb-05 10:38
messin187-Feb-05 10:38 
GeneralUsing hot key to play CD with Hook !?! Pin
TTT812-Feb-05 14:13
TTT812-Feb-05 14:13 

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.