Cursor on Win32 Window

  • Thread starter Thread starter Tamir Khason
  • Start date Start date
T

Tamir Khason

I have a control (created by interop from Win32) wich placed into other
control (regular C#), BUT I can not recieve mouse events from Win32 control
even when listening to WM_MOUSE... messages from WinProc. The only way I
can capture the mouse in the control is using MyWin32Control.Capture = true;
from the parent form, BUT after the first click in parent form the capture
stops ( even if MyWin32Control.Capture = true after perform of OnClick
event), How to rid of it? How to get Win32 control listen to parent mouse
forever???

TNX
 
Hi Tamir,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you put a win32 control in a .net
control (such as form), the win32 control cannot receive any mouse
messages. If there is any misunderstanding, please feel free to let me know.

Could you let me know what kind if control you are working on? Is it an
ActiveX control? I have tried to put an ActiveX control on a C# windows
application form. However, it works well on my computer. Could you please
try to use Spy++ to check if the message can be captured. Here are the
steps:

1. Start Spy++ from Start -> All Programs -> Microsoft Visual Studio .NET
2003 -> Visual Studio .NET Tools -> Spy++.
2. Start your application from VS.NET.
3. Click on Log Message button on the toolbar of Spy++.
4. Drag and drop the Finder Tool to the ActiveX control and click ok.
5. Then you can move mouse to the control to see if message can be captured.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thank you for response. The control added is DirectShow Windows, in Spy++ I
can see Wnd event, but the control do not escalate those messages to parent
control, HOWEVER I already solved it by inplementing
put_MessageDrain callbackes into parent.



Thank you for your time:

Following the solution (for those who interested in)

----------------Win32-----------------------------

[PreserveSig]

int put_MessageDrain( IntPtr drain );

[PreserveSig]

int get_MessageDrain( out IntPtr drain );

-------------------------------------------------------

-----------------C#-----------------------------------

hr = videoWin.put_MessageDrain(this.Handle);

if( hr < 0 )

Marshal.ThrowExceptionForHR( hr );
 
Back
Top