TrackMouseEvent (user32)
Last changed: -156.145.34.220

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

    // C#    
    // Sets the hover time to 3sec and resets MouseEnter so the cursor does not have to
    // leave the control to hover again

        [DllImport("user32.dll")]
        static extern int TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);
        [StructLayout(LayoutKind.Sequential)]
            public struct TRACKMOUSEEVENT
        {
            public UInt32 cbSize;
            public UInt32 dwFlags;
            public IntPtr hwndTrack;
            public UInt32 dwHoverTime;
        }        
        TRACKMOUSEEVENT tme;

        protected override void OnMouseHover(EventArgs e)
        {            
            OnMouseEnter(e);
            base.OnMouseHover(e);
        }

        protected override void OnMouseEnter(EventArgs e)
        {            
            base.OnMouseEnter (e);
            tme = new TRACKMOUSEEVENT();            
            tme.hwndTrack = this.Handle;            
            tme.cbSize = (uint)Marshal.SizeOf(tme);
            tme.dwFlags = TME_HOVER;
            tme.dwHoverTime = 1000 * 3;
            TrackMouseEvent(ref tme);            
        }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation