Duplicate mouse pointer

Posted on 2006-04-13
Last Modified: 2008-02-01

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
    '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?
Question by:Mark_FreeSoftware
    LVL 4

    Expert Comment

    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?
    LVL 13

    Author Comment

    yes, but i want to know how one can draw an actual linked cursor ;)
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    To what end?  Can you give us a bigger picture of what you want your application to do?
    LVL 13

    Author Comment


    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)
    LVL 26

    Accepted Solution


    set your timer interval to 1 and enabled = true

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

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now