I want to set the cursor in my program to C:\winnt\cursors\counter.ani or C:\winnt\cursors\3dgaro.cur , but i get the error Type mismatch!
What i wrong??
Printable View
I want to set the cursor in my program to C:\winnt\cursors\counter.ani or C:\winnt\cursors\3dgaro.cur , but i get the error Type mismatch!
What i wrong??
From MSDN- MouseIcon property.
You'll just have to stick with the standard coursors. :(Quote:
Visual Basic does not load animated cursor (.ani) files, even though 32-bit versions of Windows support these cursors.
But I hope that VB 7 will support animated cursors.
I am not sure if you are able to load an ani file or not, but here is the code to load a .cur file.
Whatever.MouseIcon = LoadPicture"C:winnt\cursors\3dgaro.cur")
My guess is you forgot the LoadPicture.
Theres an API with which you can implement animated cursors. The name of the function is LoadCursorFromFile!!!
try this code
Code:Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetCursor MyCursor
End Sub
Private Sub Form_Load()
MyCursor = LoadCursorFromFile("C:\winnt\cursors\counter.ani ")
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle MyCursor
End Sub