Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Hide and show the mouse cursor

Total Hit ( 3234)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


At times you may want to temporarily hide the mouse cursor, for example in order to reduce flickering. To do so you just need the ShowCursor API function:

Click here to copy the following block
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

' hide the mouse
ShowCursor False

' do whatever you need to do
' ....

' make the cursor visible again
ShowCursor True

Keep in mind that if you call the ShowCursor function more than once passing False as an argument, then you must call ShowCursor with True an equal number of times, otherwise the cursor will remain invisible. This behavior, while not intuitive, permits to call nested procedures - each one that hides and then restores the mouse cursor - and have the mouse cursor reappear only when the last procedure terminates its execution:

Click here to copy the following block
Sub RoutineOne()
  ShowCursor False
  Call RoutineTwo
  ' this makes the cursor visible again
  ShowCursor True 
End Sub

Sub RoutineTwo()
  ShowCursor False
  '
  ' do something else
  '
  ' this does NOT make the cursor visible
  ShowCursor True 
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.