Really confuse with Messages between windows

I have a thread that processes a video. If the thread is finished the process of a frame, er should send a message to a window and come back to work...and so I try that:
SendMessageCallback(HWND(&son),WM_USER,0,0,0,0);
I try to catch the WM_USER message in the sonwindow with the function WndProc. Here is the code of this function:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 virtual void WndProc(Message% m) override
                {
                    switch(m.Msg)
                    {
                    case WM_USER:
                        {
                            //my message
                            this->pictureBoxMasc->Refresh();
                            this->pictureBoxSeq->Refresh();
                            break;
                        }
                    default:
                        {
                            //OS messages
                            ResultsViewer::DefWndProc(m);
                        }
                        
                    }
                }

but the case NEVER takes the value of WM_USER.
I have used Spy++ and allways were sendt WM_USER... Where is the Problem??

Thanks in voraus

garrido
The problem is most likely &son. What is the data type of the variable 'son'?
Thanks for your response.
son is a pointer to my window, which should take the message.
I use:
ResultsViewer^ son = (ResultsViewer^)GUI::ResultsViewer::ActiveForm;
isn't that all right??

garrido
Well, you are using C++/CLI. I assume this is a Windows Forms project and that ResultsViewer is a CLI class that inherits from Form? If so, then the window handle is obtained via the Handle property: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.handle.aspx.
Thanks again for your antwort.
now it works although I did't use this Handle property (I can't understand how to convert IntPtr to HWND....).
I write what I did, maybe helps somebody in the future.
I get the handle of my window through the function Findwindow
and then gets the window the messages !!!!

1
2
HWND hWindow = FindWindow(NULL,L"Name der Window");
SendMessage(hWindow,WM_USER,0,0);


I would appreciate if someone could me say, with a example, how this Handle Propety works, because I don't understand it.

Thanks in advance
I think it is just (HWND)son->Handle. Did you try this? Again, I don't really know C++/CLI.
Topic archived. No new replies allowed.