CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: a problem of Mouse event with activeX

  1. #1
    Join Date
    Apr 2006
    Posts
    79

    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
    Last edited by vinhie47; March 21st, 2007 at 05:42 AM.
    My English is not good. So you maynot understand what I say!

  2. #2
    Join Date
    Aug 2001
    Location
    Sydney, Australia
    Posts
    813

    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.
    Microsoft LVP - Least Valuable Professional

    Please rate this post... Pleeeeeeaaassee!!!

  3. #3
    Join Date
    Apr 2006
    Posts
    79

    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).
    Last edited by vinhie47; March 21st, 2007 at 03:06 AM.
    My English is not good. So you maynot understand what I say!

  4. #4
    Join Date
    Aug 2001
    Location
    Sydney, Australia
    Posts
    813

    Re: a problem of Mouse event with activeX

    Oh ok, maybe post this in the C# forum then.
    Microsoft LVP - Least Valuable Professional

    Please rate this post... Pleeeeeeaaassee!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)