|
-
Dec 30th, 1999, 04:50 AM
#1
Thread Starter
Lively Member
Hi what I am trying to do is when the user holds down the 'Shift' key and the left mouse button the Cursor changes from the Arrow to a diffrent Image Not just on the form but on all of the other programs, I have it to were it changes the Cursor Image but it returns the cursor Image back to the arrow after the mouse is moved. the code i have is.
Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim z as long
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyShift) Then
If GetAsyncKeyState(vbLeftButton) Then
SetCursor z
End If
End If
End Sub
Private Sub Form_Load()
z = LoadCursorFromFile("Icon.cur")
End Sub
Is their away to set the system mouse pointer to one that I specifiy, or is their an better way to do this?
Thank you,
Jeremy
------------------
[email protected]
-
Dec 30th, 1999, 11:43 AM
#2
Try something like this:
Code:
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 Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private m_lIcon As Long
Private Sub Form_Load()
m_lIcon = LoadCursorFromFile("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Win95\Drive.ico")
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Do While GetAsyncKeyState(vbKeyShift)
If GetAsyncKeyState(vbLeftButton) Then
SetCursor m_lIcon
End If
Loop
End Sub
------------------
Serge
Software Developer
[email protected]
ICQ#: 51055819
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
|