Results 1 to 8 of 8

Thread: [RESOLVED] Detect mouse movement outside form.

  1. #1

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    Resolved [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!

  2. #2

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    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:
    1. Dim MouseX As Integer
    2. 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!

  3. #3
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    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

  4. #4

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    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!

  5. #5
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    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

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Detect mouse movement outside form.

    what control are you using to play the video?

  7. #7
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    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:
    1. Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    2.  
    3. 'check events......
    4.  
    5. mybase.WndProc(m)
    6.  
    7. End Sub
    Visual Studio .NET 2005/.NET Framework 2.0

  8. #8

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    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
  •  



Click Here to Expand Forum to Full Width