|
-
May 8th, 2006, 09:07 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Detect mouse movement outside form.
Hello all,
I'm creating a video player. When a video is playing fullscreen, I would like for a menu to appear when the mouse moves, but no event is triggered. The video 'covers' the form, so the form's MouseMove event is not triggered upon mouse movement.
Is there a way to trigger an event when mouse movement is detected?
If not, is there a way to get the cursor position?
Then, I could (in combination with a timer) compare the location of the cursor now and that of a few moments ago to register mouse momevent.
Thanks.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
May 8th, 2006, 10:17 AM
#2
Thread Starter
Fanatic Member
Re: Detect mouse movement outside form.
I found out how to get mouse position. It was so much simpler than expected that I completely overlooked this:
VB Code:
Dim MouseX As Integer
MouseX = CInt(Cursor.Position.X.ToString())
If some-one knows how to trigger an event on mouse movement, I would still like to know, though. Because using this in combination with a timer is not quite Feng Shui.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
May 8th, 2006, 11:12 AM
#3
Hyperactive Member
Re: Detect mouse movement outside form.
I hate the VB timmer. I'd just create a thread that just loops looking for mouse moves and then raises the event.
I've also seen buttons that are invisable that reside over other controls, but I can't seem to make this work in Vb.
Visual Studio .NET 2005/.NET Framework 2.0
-
May 8th, 2006, 11:21 AM
#4
Thread Starter
Fanatic Member
Re: Detect mouse movement outside form.
I can't put controls over the video, the video covers all. I need to use another form to display a menu over the video.
By the way, don't continuous loops take up loads of CPU?
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
May 8th, 2006, 12:48 PM
#5
Hyperactive Member
Re: Detect mouse movement outside form.
The one I used did not, however I had a ...thread.sleep(50) and ...DoEvents() in it.
Visual Studio .NET 2005/.NET Framework 2.0
-
May 8th, 2006, 12:56 PM
#6
Re: Detect mouse movement outside form.
what control are you using to play the video?
-
May 8th, 2006, 12:56 PM
#7
Hyperactive Member
Re: Detect mouse movement outside form.
If the video control is in your form, you may try to capture the event in the WndProc()
VB Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
'check events......
mybase.WndProc(m)
End Sub
Visual Studio .NET 2005/.NET Framework 2.0
-
May 11th, 2006, 04:04 PM
#8
Thread Starter
Fanatic Member
Re: Detect mouse movement outside form.
I use a panel control to play the video in.
I use the API-functions mciSendString and mciGetErrorString to play the video. This supports many files, but requires some hard coding.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|