473,487 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capture mouse when control is visible

I need to allow my control when it is visible to capture the mouse and not
let any other control react to mouse events until control is hidden.

Similar to ContextMenu

Any Suggestions

--
Ron Vecchi

Nov 15 '05 #1
6 8788
Ron,

You can call the SetCapture API function through the P/Invoke layer to
do this. The declaration is as follows:

[DllImport("user32.dll")]
public static extern IntPtr SetCapture(IntPtr hWnd);

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:u3**************@TK2MSFTNGP11.phx.gbl...
I need to allow my control when it is visible to capture the mouse and not
let any other control react to mouse events until control is hidden.

Similar to ContextMenu

Any Suggestions

--
Ron Vecchi

Nov 15 '05 #2
Thanks,

I was hoping to stay away from unmanaged code is there another way through
the framework or am I pretty much stuck with P/Invoke.
Ron

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:O3**************@tk2msftngp13.phx.gbl...
Ron,

You can call the SetCapture API function through the P/Invoke layer to
do this. The declaration is as follows:

[DllImport("user32.dll")]
public static extern IntPtr SetCapture(IntPtr hWnd);

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:u3**************@TK2MSFTNGP11.phx.gbl...
I need to allow my control when it is visible to capture the mouse and not let any other control react to mouse events until control is hidden.

Similar to ContextMenu

Any Suggestions

--
Ron Vecchi


Nov 15 '05 #3

Hi Ron,

In your "not let any other control react to mouse events", what does your
"other control" refer to?
If it refers only to the controls in the same form, I think you can
intercept all the Mouse message to the form and pass it to your certain
control.

If it refers to all the forms in windows, I think the only way is through
SetCapture method.

Anyway, I recommand you P/inovke SetCapture.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4

Hi Ron,

Do you still have any concern on this issue?
Actually, .Net did not include all the feature of windows.
So it introduces the P/invoke technical to supplement it. Many platform
related issue should be completed through P/invoke.(Such as Hook technical,
Memory Mapping File, etc)
Through P/invoke, you can invoke the win32 APIs of windows.

For more information about P/invoke, please refer to the article below:
http://msdn.microsoft.com/msdnmag/issues/03/07/NET/

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #5
Thanks Jeffrey,

Since my menu control is basically for my own personal use I decided to
create my own form inhertied from System.windows.Form
The form will interact with the menu control to provide the nesessary
functionality.

I want to stay away from P/Invoke so I can use the controls with MONO.

Thanks
""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:bd**************@cpmsftngxa07.phx.gbl...

Hi Ron,

Do you still have any concern on this issue?
Actually, .Net did not include all the feature of windows.
So it introduces the P/invoke technical to supplement it. Many platform
related issue should be completed through P/invoke.(Such as Hook technical, Memory Mapping File, etc)
Through P/invoke, you can invoke the win32 APIs of windows.

For more information about P/invoke, please refer to the article below:
http://msdn.microsoft.com/msdnmag/issues/03/07/NET/

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #6

Hi Ron,

Oh, I see your concern, but the .Net class library still did not included
this feature of classes, so I think it can only be done through the support
of specifical platform.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
392
by: LRD | last post by:
Form not refreshing after autopostback unless keyboard or mouse move Hi, We created several new ASP.NET C# forms for our intranet. In each form we use panels for different sections of the...
1
1743
by: Dave | last post by:
Hi, How can i capture the mouse move event of my window form when i move it ebove other control? Thanks!
3
2682
by: Raj Chudasama | last post by:
i have a custom control derived from usercontrol (called popupwin). I have another usercontrol (called extensionbutton). In the extension button i have declared a variable as follows: private...
3
3025
by: Dave | last post by:
Hi, I have a control on my vb app form that dont cath a mouse event`s how can i catch a mouse event on that control and pass it to a function in my main form??? In VB-6 i used the setcapture api...
2
5006
by: TC | last post by:
Hello, I need to build a very simple text editor. The requirement is that the input screen should be divided into 'm*n' cells ('m' rows, 'n' columns, with each cell of a fixed size). Whenever...
2
5841
by: =?Utf-8?B?c25naWxi?= | last post by:
The WebBrowser control is described as exposing numerous public mouse events. See: http://msdn2.microsoft.com/en-us/library/ayestehw.aspx. many of the event are described as: "This event is not...
2
5558
by: cefrancke | last post by:
Is there a way to capture all relevant info about the mouse, without using Mouse Up/Down etc. procedures? I'm trying to make a custom function and send it the mouse info on the click event. ...
1
5020
by: P-GPS | last post by:
Hi, 1. I have a webbrowser control in a VB .NET (3.5) application. 2. I want to capture the event and call a function whenever the mouse is hovering over a hyperlink. How do I do this? 3. I...
2
3111
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.