[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

Duplicate mouse pointer

what i want to do is this:

copy the current cursor to a form or picturebox, and make it look like a second cursor

i found this code on the net to copy the cursor to a form:

Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function GetCursor Lib "user32" () As Long
Private Sub Form_Paint()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Draw the current cursor on this form
    DrawIcon Me.hdc, 0, 0, GetCursor
End Sub

but then it doesn't change when the mousecursor changes
is it somehow possible to create an instance of the cursor on my form?
1 Solution
it's not gonig to change unless you change it.  what you've done is drawn a copy of it on the form, not drawn an actual linked cursor.

does that help?
Mark_FreeSoftwareAuthor Commented:
yes, but i want to know how one can draw an actual linked cursor ;)
Mike TomlinsonMiddle School Assistant TeacherCommented:
To what end?  Can you give us a bigger picture of what you want your application to do?
Mark_FreeSoftwareAuthor Commented:

basically i want four mouse pointers on my screen,

1 as a normal pointer, the other 3 a bit grayed out so it is clear what is the active one

(don't ask, it was a customer who came with the idea of 4 pointers)

set your timer interval to 1 and enabled = true

Private Sub Timer1_Timer()
DrawIcon Me.hdc, 10, 10, GetCursor
End Sub

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now