Results 1 to 3 of 3

Thread: Mouse Cursor Compatibility

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Thumbs down

    Does VB only dislpay 2-Colour mouse cursors? I made 256-colour mouse cursors, and they turn into 2-colour when I load them into VB! Also, VB has no support for animated mouse cursors. Should I just hide the mouse cursor and make a custom one? (DirectDraw Fullscreen App)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2
    Guest
    To use Animated Cursors, insert the following code into a Form with a CommandButton and CommonDialog.

    Code:
    Private Declare Function LoadCursorFromFile Lib "User32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
    Private Declare Function SetClassLong Lib "User32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Const GCL_HCURSOR = (-12)
    Dim prevCur As Long
    Dim MyCursor As Long
    
    Private Sub Command1_Click()
    
        Dim OpenFile As String
        CommonDialog1.Filter = "Animated Cursors (*.ani)|*.ani"
        CommonDialog1.ShowOpen
        
        OpenFile = CommonDialog1.filename
        
        MyCursor = LoadCursorFromFile(OpenFile)
        prevCur = SetClassLong(Me.hwnd, GCL_HCURSOR, MyCursor)
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        prevCur = SetClassLong(Me.hwnd, GCL_HCURSOR, hOldCursor)
    End Sub

  3. #3
    Guest
    Regarding your first question, VB can only display monochrome cursors but if you load an icon instead, it will display it in colours.

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