Paul Warren
Apr 26th, 2001, 08:52 AM
Does anyone have an example of using LoadCursor and SetCursor to change the Windows cursor ? I've tried it but the LoadCursor call just returns a handle of 0 which causes the SetCursor to make the cursor disappear. I'm using NT if that makes a difference, and here's the code I use :
' Used to set the cursor to the crosshair on all app's
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorW" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
' Crosshair cursor
Private Const IDC_CROSS = 32515&
Private Sub Command1_Click()
Dim hCursor As Long
Dim RetVal As Long
' Change the cursor to a crosshair - returns 0 at the moment !
hCursor = LoadCursor(ByVal 0&, IDC_CROSS)
RetVal = SetCursor(hCursor)
End Sub
Thanks in advance.
' Used to set the cursor to the crosshair on all app's
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorW" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
' Crosshair cursor
Private Const IDC_CROSS = 32515&
Private Sub Command1_Click()
Dim hCursor As Long
Dim RetVal As Long
' Change the cursor to a crosshair - returns 0 at the moment !
hCursor = LoadCursor(ByVal 0&, IDC_CROSS)
RetVal = SetCursor(hCursor)
End Sub
Thanks in advance.