Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
// 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 hWnd;
public UInt32 dwHoverTime;
TRACKMOUSEEVENT tme; // Define it on the outside so you dont recreate it each time the mouse enters
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
tme = new TRACKMOUSEEVENT();
tme.hWnd = this.Handle;
tme.cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT)); // make sure it gets correct size in different platforms
tme.dwFlags = TME_HOVER;
tme.dwHoverTime = 1000 * 3;
TrackMouseEvent(ref tme);
}
Alternative Managed API:
The Control.MouseEnter, Control.MouseLeave and Control.MouseHover events.
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).