a problem of Mouse event with activeX
Hi everybody,
Now I countering a strange problem with mouse event. In my ActiveX control, I show a MessageBox whenever mouse move in the activeX control.
You can see it as below:
Code:
void CMyCOMCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
MessageBox("moving");
COleControl::OnMouseMove(nFlags, point);
}
It 's too normal, there isn't any unusual (of course).
Now I use this activeX in a C# application, when I move mouse over the control, certainly this message appear. But when I press left mouse button down (WM_LBUTTONDOWN) and move mouse over the control, nothing happen. I can't understand what's the problem. Could you explain it for me.
P/S: if I use this control in a VC++ application, everything go well.
Thanks in advance.
Best regards,
Vinh
Re: a problem of Mouse event with activeX
Looks like you are passing the focus onto the window of the activeX control when you click on it and it doesn't support mousemove or it doesnt pass that on to the main message pump.
Try making the activex control windows OnLButtonDown code to give focus back to your main window. This way when you move your mouse over it even if you have clicked it the focus will go back to the main window and you can still capture the mousemove events.
Re: a problem of Mouse event with activeX
Thanks for reply. I forget say that I press left button down outside of activeX control. If I press WM_LBUTTONDOWN inside the control and move mouse, certainly the messagebox appear, but If I press WM_LBUTTONDOWN outside the ActiveX control and move mouse over the control, no message appear.
It seems that when I press WM_LBUTTONDOWN outside the control, WM_MOUSEMOVE message isn't activated.
And the strange problem here is if I use this activeX control in a VC++ project, everything run well. The above problem only happen when I use this activeX in C# project (I 've already created many new project and there isn't difference).
Re: a problem of Mouse event with activeX
Oh ok, maybe post this in the C# forum then.