Click here to Skip to main content
15,889,556 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help with threads Pin
Albert Holguin5-Sep-12 12:23
professionalAlbert Holguin5-Sep-12 12:23 
GeneralRe: Help with threads Pin
Richard MacCutchan4-Sep-12 22:06
mveRichard MacCutchan4-Sep-12 22:06 
QuestionRe: Help with threads Pin
David Crow5-Sep-12 3:15
David Crow5-Sep-12 3:15 
AnswerRe: Help with threads Pin
pasztorpisti5-Sep-12 3:31
pasztorpisti5-Sep-12 3:31 
GeneralRe: Help with threads Pin
David Crow5-Sep-12 3:46
David Crow5-Sep-12 3:46 
GeneralRe: Help with threads Pin
pasztorpisti5-Sep-12 3:55
pasztorpisti5-Sep-12 3:55 
GeneralRe: Help with threads Pin
Albert Holguin5-Sep-12 12:26
professionalAlbert Holguin5-Sep-12 12:26 
AnswerRe: Help with threads Pin
Chuck O'Toole5-Sep-12 3:57
Chuck O'Toole5-Sep-12 3:57 
DavidCrow wrote:
For example, the secondary thread sends a "add item to the control" message
(e.g., LB_ADDSTRING) to the primary thread


This is the scenario that's confused me from time to time. It is really legal for a thread to do a SendMessage() to a control (the target of the LB_ADDSTRING) that is owned by another thread? I thought that Windows checked "thread ownership" of the control and returned an error on the SendMessage(). If the "primary thread" is, as is implied in your reply, the UI thread, then the "secondary thread" should not be allowed access to the control.

I've always used "PostMessage()" and used "user defined messages" to have secondary threads pass messages / commands to the primary thread for action. Since "PostMessage()" is just a queueing action, there is no deadlock (although you might not get the immediate feedback of a screen update).

Does anyone have the definitive answer on "SendMessage and Control Owner Thread" question?
GeneralRe: Help with threads Pin
Albert Holguin5-Sep-12 12:25
professionalAlbert Holguin5-Sep-12 12:25 
AnswerRe: Help with threads Pin
Chuck O'Toole6-Sep-12 15:46
Chuck O'Toole6-Sep-12 15:46 
GeneralRe: Help with threads Pin
Albert Holguin7-Sep-12 3:54
professionalAlbert Holguin7-Sep-12 3:54 
QuestionRe: Help with threads Pin
AndrewG12315-Sep-12 9:55
AndrewG12315-Sep-12 9:55 
AnswerRe: Help with threads Pin
David Crow6-Sep-12 5:41
David Crow6-Sep-12 5:41 
QuestionRe: Help with threads Pin
AndrewG123111-Sep-12 11:33
AndrewG123111-Sep-12 11:33 
QuestionRe: Help with threads Pin
David Crow12-Sep-12 2:45
David Crow12-Sep-12 2:45 
GeneralRe: Help with threads Pin
AndrewG123112-Sep-12 6:21
AndrewG123112-Sep-12 6:21 
SuggestionRe: Help with threads Pin
David Crow12-Sep-12 8:17
David Crow12-Sep-12 8:17 
QuestionRe: Help with threads Pin
AndrewG123112-Sep-12 14:21
AndrewG123112-Sep-12 14:21 
AnswerRe: Help with threads Pin
David Crow13-Sep-12 3:47
David Crow13-Sep-12 3:47 
GeneralRe: Help with threads Pin
AndrewG123113-Sep-12 7:46
AndrewG123113-Sep-12 7:46 
GeneralRe: Help with threads Pin
David Crow13-Sep-12 7:55
David Crow13-Sep-12 7:55 
GeneralRe: Help with threads Pin
AndrewG123113-Sep-12 8:54
AndrewG123113-Sep-12 8:54 
QuestionRe: Help with threads Pin
David Crow13-Sep-12 9:32
David Crow13-Sep-12 9:32 
AnswerRe: Help with threads Pin
AndrewG123127-Sep-12 12:02
AndrewG123127-Sep-12 12:02 
GeneralRe: Help with threads Pin
David Crow28-Sep-12 2:13
David Crow28-Sep-12 2: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.