Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Serialization and schema numbers Pin
Mark Salsbery21-Nov-08 6:13
Mark Salsbery21-Nov-08 6:13 
QuestionAVI frame grabber – needs timer, why? [modified] SOLVED Pin
Vaclav_21-Nov-08 5:08
Vaclav_21-Nov-08 5:08 
AnswerRe: AVI frame grabber – needs timer, why? Pin
Mark Salsbery21-Nov-08 6:54
Mark Salsbery21-Nov-08 6:54 
GeneralRe: AVI frame grabber – needs timer, why? Pin
Vaclav_23-Nov-08 5:48
Vaclav_23-Nov-08 5:48 
QuestionUser-defined objects in Windows message parameters Pin
Atropus21-Nov-08 3:50
Atropus21-Nov-08 3:50 
AnswerRe: User-defined objects in Windows message parameters Pin
Matthew Faithfull21-Nov-08 4:00
Matthew Faithfull21-Nov-08 4:00 
AnswerRe: User-defined objects in Windows message parameters Pin
Rajasekharan Vengalil21-Nov-08 5:31
Rajasekharan Vengalil21-Nov-08 5:31 
AnswerRe: User-defined objects in Windows message parameters Pin
Roger Stoltz21-Nov-08 5:56
Roger Stoltz21-Nov-08 5:56 
Ummm, I don't see what the problem is.... Confused | :confused:
You don't say anything about what you've tried so far and how it fails, it looks to be more of a design question...


Atropus wrote:
I've made a working thread that interact with a window by user-defined messages (WM_USER + x)


Quite all right, as long as you use PostMessage() and not SendMessage() to avoid a deadlock situation. But you should not use WM_USER; at least use WM_APP.
What you really should do is use registered messages.
Read this[^].


Atropus wrote:
I would like use WPARAM and/or LPARAM to give to the window objects allocated in the working thread.


This should in most cases be fine as well, depending on what type of object you're allocating. Read the article linked to above.
It could be dangerous if it's an MFC object since MFC classes wraps objects like e.g. windows and sockets that are referred to through a handle and the MFC object handle map is on per thread basis.
But if it really is an MFC object your trying to pass you should re-evaluate your design because you'll get into troubles sooner or later.


Atropus wrote:
I know that the object I want pass through the message must be deallocated and I've tried to use the SendMessageCallback function


Deallocate the object in the message handler.
The only danger you'll expose yourself to is a memory leak if the message for some reason should not be handled. But if that happens the memory leak would be the least of your problems.


You should really read this article[^] before continuing with your worker thread.
It's the best introduction to worker threads I've come across.


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


QuestionSimple CFileDialog Question Pin
sabdalla8021-Nov-08 2:59
sabdalla8021-Nov-08 2:59 
QuestionRe: Simple CFileDialog Question Pin
David Crow21-Nov-08 3:05
David Crow21-Nov-08 3:05 
AnswerRe: Simple CFileDialog Question Pin
sabdalla8021-Nov-08 3:32
sabdalla8021-Nov-08 3:32 
GeneralRe: Simple CFileDialog Question Pin
Rajasekharan Vengalil21-Nov-08 5:34
Rajasekharan Vengalil21-Nov-08 5:34 
GeneralRe: Simple CFileDialog Question Pin
sabdalla8021-Nov-08 6:01
sabdalla8021-Nov-08 6:01 
GeneralRe: Simple CFileDialog Question Pin
Rajasekharan Vengalil21-Nov-08 6:12
Rajasekharan Vengalil21-Nov-08 6:12 
QuestionDate greater than 2038 Pin
s@tish21-Nov-08 1:15
s@tish21-Nov-08 1:15 
AnswerRe: Date greater than 2038 Pin
Nibu babu thomas21-Nov-08 1:24
Nibu babu thomas21-Nov-08 1:24 
AnswerRe: Date greater than 2038 Pin
_AnsHUMAN_ 21-Nov-08 1:24
_AnsHUMAN_ 21-Nov-08 1:24 
QuestionLPBYTE to CString Pin
cpvc++21-Nov-08 1:12
cpvc++21-Nov-08 1:12 
AnswerRe: LPBYTE to CString Pin
Nibu babu thomas21-Nov-08 1:27
Nibu babu thomas21-Nov-08 1:27 
GeneralRe: LPBYTE to CString Pin
cpvc++21-Nov-08 1:29
cpvc++21-Nov-08 1:29 
GeneralRe: LPBYTE to CString Pin
David Crow21-Nov-08 3:02
David Crow21-Nov-08 3:02 
GeneralRe: LPBYTE to CString Pin
Rajasekharan Vengalil21-Nov-08 5:43
Rajasekharan Vengalil21-Nov-08 5:43 
QuestionIn a dll, exception handling works in Debug but not in Release Pin
sashoalm21-Nov-08 1:09
sashoalm21-Nov-08 1:09 
AnswerRe: In a dll, exception handling works in Debug but not in Release Pin
_AnsHUMAN_ 21-Nov-08 1:15
_AnsHUMAN_ 21-Nov-08 1:15 
AnswerRe: In a dll, exception handling works in Debug but not in Release Pin
Randor 21-Nov-08 5:26
professional Randor 21-Nov-08 5:26 

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.