Ummm, I don't see what the problem is.... :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