Results 1 to 8 of 8

Thread: Where can I download this mouse pointer icon?

  1. #1

    Thread Starter
    Lively Member Shaq's Avatar
    Join Date
    May 2009
    Location
    Rhode Island
    Posts
    89

    Question Where can I download this mouse pointer icon?

    Anyone know where I can download an icon image of this mouse pointer? I want to use it in a VB program, but they don't have this one built in. I'm gonna have to use it as a custom mouse pointer, but I don't know where to find it as an icon file.



    Thanks.

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Where can I download this mouse pointer icon?

    Heres one way to do that...
    Code:
    Option Explicit
    Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
    Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
    Private Const IDC_HAND As Long = &H7F89 '32649
    
    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ' set mouse pointer to hand
        SetCursor LoadCursor(0, IDC_HAND)
    End Sub

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Where can I download this mouse pointer icon?

    Well, the hand icons come with VB I believe, it is installed in VB's common\graphics\cursors folder, but I've uploaded them for you if you want to try to use them.

    Also, you may want to look at a small project I wrote concerning the Hand icon. It is located on PSC.
    Attached Files Attached Files
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    Lively Member Shaq's Avatar
    Join Date
    May 2009
    Location
    Rhode Island
    Posts
    89

    Re: Where can I download this mouse pointer icon?

    Thanks guys!

    EDIT: The directory had some hand icons, but not this one. I'll try that code.

  5. #5

    Thread Starter
    Lively Member Shaq's Avatar
    Join Date
    May 2009
    Location
    Rhode Island
    Posts
    89

    Re: Where can I download this mouse pointer icon?

    Quote Originally Posted by Edgemeal View Post
    Heres one way to do that...
    Code:
    Option Explicit
    Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
    Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
    Private Const IDC_HAND As Long = &H7F89 '32649
    
    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ' set mouse pointer to hand
        SetCursor LoadCursor(0, IDC_HAND)
    End Sub
    Thanks for this code, it worked perfectly. But what exactly is this doing? I don't understand where it's getting the hand from.

  6. #6

    Thread Starter
    Lively Member Shaq's Avatar
    Join Date
    May 2009
    Location
    Rhode Island
    Posts
    89

    Re: Where can I download this mouse pointer icon?

    How would I write that code for a module? Would I just replace the privates with global?

  7. #7
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Where can I download this mouse pointer icon?

    Quote Originally Posted by Shaq View Post
    How would I write that code for a module? Would I just replace the privates with global?
    Yes or replace Private with Public.

  8. #8
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Where can I download this mouse pointer icon?

    As for how/why the code works: LoadCursor gets a cursor handle from a requested instance such as the system (which is always 0). System has a bunch of predeclared integer values for many of the cursors you see on the system, all those IDC_something constants. You could also load cursors from an attached resource file of your own program, in that case you'd need to pass a String instead of an integer value. This would require a small change into the LoadCursor API call declaration, but since you don't need it now it doesn't matter.

    SetCursor then takes the handle that was returned by LoadCursor. As the system cursors are always available, you do not need to free the handle. With resource icons, I think, you need to also free the handle by using DeleteObject API call when the cursor is no longer required.


    I don't know whether this confused more than helped but that is somewhat the bare bones explanation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width