Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSet the system cursor
DescriptionThis example shows how to set the system cursor in Visual Basic 6. It uses the CopyCursor, LoadCursorFromFile, GetCursor, and SetSystemCursor API functions.
Keywordssystem cursor, cursor
CategoriesGraphics, Windows
 
This program uses the CopyCursor, LoadCursorFromFile, GetCursor, and SetSystemCursor API functions. To display a new system cursor, it uses LoadCursorFromFile to load the cursor. It uses GetCursor to save the old cursor and then sets the new system cursor.
 
Private Sub CmdAnimateCursor_Click()
Dim filename As String

    ' Use the first cursor in this directory.
    ' Note: Change WinNT to Windows for Win95 or Win98.
    filename = "C:\Windows\Cursors\" & _
        Dir$("C:\Windows\Cursors\*.ani")
    'filename = "C:\WinNT\Cursors\" & _
    '    Dir$("C:\WinNT\Cursors\*.ani")

    ' Load the cursor.
    new_cursor = LoadCursorFromFile(filename)
    old_cursor = GetCursor()
    old_cursor = CopyCursor(old_cursor)
    SetSystemCursor new_cursor, OCR_NORMAL
End Sub

Private Sub CmdNormalCursor_Click()
    SetSystemCursor old_cursor, OCR_NORMAL
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated