Results 1 to 15 of 15

Thread: [RESOLVED] API - Mouse over hand icon

  1. #1

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Resolved [RESOLVED] API - Mouse over hand icon

    I know you can set the MouseIcon and MousePointer properties, but I don't want to do that.

    Someone (I think RhinoBull?) posted some code using API to automatically show that hand pointer when the mouse hovers over a control. That's what I need.

  2. #2
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: API - Mouse over hand icon

    Quote Originally Posted by DigiRev
    I know you can set the MouseIcon and MousePointer properties, but I don't want to do that.

    Someone (I think RhinoBull?) posted some code using API to automatically show that hand pointer when the mouse hovers over a control. That's what I need.
    You don't need an API to do that. You can simply put your mouse cursor change code in a Mouse_Move event for the controls in question. All the cursors/icons are in your vb directory including h_point.cur. The MousePointer property also has to be set or coded to (99) Custom.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: API - Mouse over hand icon

    Quote Originally Posted by CDRIVE
    You don't need an API to do that. You can simply put your mouse cursor change code in a Mouse_Move event for the controls in question. All the cursors/icons are in your vb directory including h_point.cur. The MousePointer property also has to be set or coded to (99) Custom.
    I don't think the hand is there.

  4. #4

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: API - Mouse over hand icon

    I'm trying to do it without using a MouseIcon. I want the standard "white hand" that you see when hovering over a hyperlink, for example.

    I remember the code I saw used the MouseMove event but it didn't require setting any of the MousePointer or MouseIcon properties.

  5. #5
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: API - Mouse over hand icon

    Quote Originally Posted by DigiRev
    I know you can set the MouseIcon and MousePointer properties, but I don't want to do that.

    Someone (I think RhinoBull?) posted some code using API to automatically show that hand pointer when the mouse hovers over a control. That's what I need.
    Hi,

    If you use API, you'll always have the current system pointer, here's the code:

    Code:
    ' General declaration section
    Private Const IDC_HAND = 32649&
    Private Const IDC_ARROW = 32512&
    Private Const IDC_WAIT = 32514&
    
    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
    
    ' MouseOver event where you want the hand...
    
       SetCursor LoadCursor(0, IDC_HAND)
    HTH
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: API - Mouse over hand icon

    Quote Originally Posted by jmsrickland
    I don't think the hand is there.
    Now that you mention it, I have it there because I used it so often for Mouse_Move events that I probably copied it from my Sys files.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  7. #7

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: API - Mouse over hand icon

    Jottum, that's exactly what I was looking for, thanks.

    Code:
    Option Explicit
    
    ' General declaration section
    Private Const IDC_HAND = 32649&
    Private Const IDC_ARROW = 32512&
    Private Const IDC_WAIT = 32514&
    
    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 Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        SetCursor LoadCursor(0, IDC_HAND)
    End Sub

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] API - Mouse over hand icon

    That is nice. I'm going back to all my applications where I loaded an icon from the folder and change them to that method.

  9. #9
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: [RESOLVED] API - Mouse over hand icon

    Quote Originally Posted by jmsrickland
    That is nice. I'm going back to all my applications where I loaded an icon from the folder and change them to that method.
    Yes, it certainly is! I like this a heck of a lot better than calling the icon from a folder. Do you have any more Hex values for other icons, or can you point us to where to find those values?
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  10. #10

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [RESOLVED] API - Mouse over hand icon

    Quote Originally Posted by CDRIVE
    Yes, it certainly is! I like this a heck of a lot better than calling the icon from a folder. Do you have any more Hex values for other icons, or can you point us to where to find those values?
    These are the IDC constants from the API viewer that comes with VB6:

    Code:
    Private Const IDC_APPSTARTING = 32650&
    Private Const IDC_ARROW = 32512&
    Private Const IDC_CROSS = 32515&
    Private Const IDC_IBEAM = 32513&
    Private Const IDC_ICON = 32641&
    Private Const IDC_NO = 32648&
    Private Const IDC_SIZE = 32640&
    Private Const IDC_SIZEALL = 32646&
    Private Const IDC_SIZENESW = 32643&
    Private Const IDC_SIZENS = 32645&
    Private Const IDC_SIZENWSE = 32642&
    Private Const IDC_SIZEWE = 32644&
    Private Const IDC_UPARROW = 32516&
    Private Const IDC_WAIT = 32514&

  11. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] API - Mouse over hand icon

    I wonder if it is possible to create your own custom made ones and somehow add them to this list giving them some IDC_MYCUSTOMTHING = nnnnnnn

  12. #12
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: [RESOLVED] API - Mouse over hand icon

    Quote Originally Posted by DigiRev
    These are the IDC constants from the API viewer that comes with VB6:
    DigiRev, thank you for the constants. I'll take a tour through the viewer.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  13. #13

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [RESOLVED] API - Mouse over hand icon

    Quote Originally Posted by jmsrickland
    I wonder if it is possible to create your own custom made ones and somehow add them to this list giving them some IDC_MYCUSTOMTHING = nnnnnnn
    http://allapi.mentalis.org/apilist/L...FromFile.shtml

  14. #14
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: API - Mouse over hand icon

    Quote Originally Posted by DigiRev
    Jottum, that's exactly what I was looking for, thanks.
    [...]

    You're welcome!
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  15. #15
    New Member
    Join Date
    Feb 2008
    Posts
    1

    Re: [RESOLVED] API - Mouse over hand icon

    thanks Jottum

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