-
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)
-
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
-
Regarding your first question, VB can only display monochrome cursors but if you load an icon instead, it will display it in colours.