|
-
Apr 26th, 2001, 08:52 AM
#1
Thread Starter
Hyperactive Member
Changing Windows Cursor
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 :
Code:
' 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.
That's Mr Mullet to you, you mulletless wonder.
-
Apr 26th, 2001, 04:44 PM
#2
You don't really need API For this.
Code:
Screen.MousePointer = 99
Screen.MousePointer = LoadPicture(MyCursor.cur)
To hide the Mouse, use the ShowCursor function.
-
Apr 26th, 2001, 04:55 PM
#3
Guru
Actually the MouseIcon property should be used in the 2nd line.
Or if you just want the crosshair:
Code:
Screen.MousePointer = vbCrosshair
< (ignore, I must)
-
Apr 26th, 2001, 05:23 PM
#4
Yes, it should.
(Sorry, I just copied and pasted the line)
-
Apr 27th, 2001, 03:08 AM
#5
Thread Starter
Hyperactive Member
Cheers guys, I was being particularly dim when I asked. I had API on the brain and didn't think VB might actually do it for me !
That's Mr Mullet to you, you mulletless wonder.
-
Apr 27th, 2001, 05:43 AM
#6
Guru
Don't worry - VB usually can't do much by itself anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|