CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    Pakistan
    Posts
    223

    How can I hide mouse pointer when it comes over my window

    hi
    can i hide mouse pointer , when it comes over a window.
    Unmanaged in a .NET world

  2. #2
    Join Date
    Aug 2004
    Location
    Bucharest, Romania... sometimes
    Posts
    1,039

    Re: How can I hide mouse pointer when it comes over my window

    This thread should belong to WinAPI forum. Use ShowCursor() to change the visibility of the cursor. This is used in conjunction with SetCapture() and ReleaseCapture() in order to make a good mouse-over behaviour.
    I recommend a similar code in your window procedure when hadling the WM_MOUSEMOVE message:

    Code:
    	case WM_MOUSEMOVE:
    		GetCursorPos(&ptCurrentMousePosit);
    		if (!mCaptive)
    		{
    			SetCapture(hwnd);
    			ShowCursor(FALSE);
    			mCaptive = true;
    		}
    		else
    		{
    			if (WindowFromPoint(ptCurrentMousePosit) != hwnd)
    			{
    				ShowCursor(TRUE);
    				ReleaseCapture();
    				mCaptive = false;
    			}
    		}
    		break;
    Choose your own place to declare the following used variables:
    Code:
    	static bool mCaptive;
    	static POINT ptCurrentMousePosit;
    Bye,
    Bogdan Apostol
    ESRI Developer Network

    Compilers demystified - Function pointers in Visual Basic 6.0
    Enables the use of function pointers in VB6 and shows how to embed native code in a VB application.

    Customize your R2H
    The unofficial board dedicated to ASUS R2H UMPC owners.

  3. #3
    Join Date
    May 2003
    Location
    Pakistan
    Posts
    223

    Re: How can I hide mouse pointer when it comes over my window

    Thanx a lot
    Unmanaged in a .NET world

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

Featured