Click here to Skip to main content
15,883,772 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Detecting Windows SDK version using macros Pin
Stuart Dootson8-Apr-09 9:20
professionalStuart Dootson8-Apr-09 9:20 
GeneralRe: Detecting Windows SDK version using macros Pin
tareqsiraj8-Apr-09 9:53
tareqsiraj8-Apr-09 9:53 
AnswerRe: Detecting Windows SDK version using macros Pin
Randor 9-Apr-09 1:12
professional Randor 9-Apr-09 1:12 
GeneralRe: Detecting Windows SDK version using macros Pin
tareqsiraj9-Apr-09 7:35
tareqsiraj9-Apr-09 7:35 
QuestionNew Thread and WM_QUIT Pin
TheScientistIsDead8-Apr-09 7:00
TheScientistIsDead8-Apr-09 7:00 
AnswerRe: New Thread and WM_QUIT Pin
Stuart Dootson8-Apr-09 8:29
professionalStuart Dootson8-Apr-09 8:29 
GeneralRe: New Thread and WM_QUIT Pin
TheScientistIsDead8-Apr-09 16:44
TheScientistIsDead8-Apr-09 16:44 
GeneralRe: New Thread and WM_QUIT Pin
Stuart Dootson8-Apr-09 20:10
professionalStuart Dootson8-Apr-09 20:10 
TheScientistIsDead wrote:
Isn't there an issue regarding threads and access to process-wide variables/data


Oh yeah - you've got to be very careful. The general rule is that you read things like ints (i.e. 4 bytes or less) without synchronisation, but everything else needs to be synchronised, really.

TheScientistIsDead wrote:
Will I be able to kill a thread, while its in the middle of doing some kind of processing, from the main thread?


There is TerminateThread[^], but its use is discouraged.

TheScientistIsDead wrote:
And can I change the flag's status (if quit is posted after I initialize the new thread)



Yes. In your WM_QUIT handler, I'd do something like this:

// we have a thread handle, hThread and a shared LONG variable lQuit which is zero until it's time to quit
InterlockedExchange(&lQuit, 1);
::WaitForSingleObject(hThread, INFINITE);


and in the worker thread function:

// do stuff
if (lQuit) ExitThread(0);
// do some more stuff
if (lQuit) ExitThread(0);


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

AnswerRe: New Thread and WM_QUIT Pin
Roger Stoltz8-Apr-09 21:31
Roger Stoltz8-Apr-09 21:31 
QuestionSetting REG_MULTI_SZ value Pin
csrss8-Apr-09 5:17
csrss8-Apr-09 5:17 
QuestionRe: Setting REG_MULTI_SZ value Pin
CPallini8-Apr-09 7:30
mveCPallini8-Apr-09 7:30 
AnswerRe: Setting REG_MULTI_SZ value Pin
csrss8-Apr-09 8:06
csrss8-Apr-09 8:06 
GeneralRe: Setting REG_MULTI_SZ value Pin
CPallini8-Apr-09 10:14
mveCPallini8-Apr-09 10:14 
Questiona managed array cannot have this element type Pin
Member 20210228-Apr-09 3:55
Member 20210228-Apr-09 3:55 
AnswerRe: a managed array cannot have this element type Pin
Cedric Moonen8-Apr-09 4:03
Cedric Moonen8-Apr-09 4:03 
AnswerAsked and answered 2 weeks ago Pin
led mike8-Apr-09 4:23
led mike8-Apr-09 4:23 
QuestionTripleDES ECB in Visual C++ Pin
annese8-Apr-09 2:55
annese8-Apr-09 2:55 
AnswerRe: TripleDES ECB in Visual C++ Pin
Chris Losinger8-Apr-09 6:34
professionalChris Losinger8-Apr-09 6:34 
Questionborder of the childframe Pin
prithaa8-Apr-09 2:36
prithaa8-Apr-09 2:36 
AnswerRe: border of the childframe Pin
Code-o-mat8-Apr-09 2:52
Code-o-mat8-Apr-09 2:52 
GeneralRe: border of the childframe Pin
prithaa8-Apr-09 3:09
prithaa8-Apr-09 3:09 
QuestionHelp with how to add/mix RGBA values Pin
spiffen8-Apr-09 1:17
spiffen8-Apr-09 1:17 
AnswerRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 1:24
Iain Clarke, Warrior Programmer8-Apr-09 1:24 
GeneralRe: Help with how to add/mix RGBA values Pin
spiffen8-Apr-09 2:22
spiffen8-Apr-09 2:22 
GeneralRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 2:32
Iain Clarke, Warrior Programmer8-Apr-09 2:32 

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.