Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Hand cursor/icon like with Internet Explorer hyperlink

Hi all

I have found an alternative solution to the problem of a suitable
cursor to emulate a hyperlink. I have a label with a Click event, and
I want the cursor to look like the hand over a hyperlink in Internet
Explorer.

I've tried the hyperlink cursor solution provided by John Walkenbach
and others, but I don't really like the cursor image (nor have I been
able to find one I like).

I found another solution on Google that others might find useful,
because the cursor appears to be the IE cursor.
The first block of code goes into a module:

Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&

Public Sub SetHandCur(Hand As Boolean)
If Hand = True Then
SetCursor LoadCursor(0, IDC_HAND)
Else
SetCursor LoadCursor(0, IDC_ARROW)
End If
End Sub
__________________________________________________ _______

Then, on the UserForm for the label (or relevant control) MouseMove
and MouseDown events:

SetHandCur True

When the cursor is over the control, the cursor changes, and using the
MouseDown event ensures that the cursor does not revert to default
when clicking a mouse button.

Regards

Paul Martin
Melbourne, Australia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hand cursor/icon like with Internet Explorer hyperlink

PS The original posting may be found at:
<http://groups.google.com.au/group/microsoft.public.vb.syntax/msg/7675b4d391cc386c?hl=en

I have modified the code as follows:

Public Sub SetHandCursor(bUseHandA As Boolean)
Dim lCursor As Long

lCursor = IIf(bUseHandA = True, IDC_HAND, IDC_ARROW)
SetCursor LoadCursor(0, lCursor)
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does Internet Explorer open a jpeg from a hyperlink ??? Roman Excel Discussion (Misc queries) 0 June 15th 09 05:44 PM
Why does Internet Explorer open a jpeg from a hyperlink ??? Roman Excel Discussion (Misc queries) 11 June 15th 09 05:35 PM
Internet Explorer opens jpeg from a hyperlink ??? Roman Excel Worksheet Functions 0 June 11th 09 01:23 PM
Hyperlink to a .gif opens with Internet Explorer jase Excel Discussion (Misc queries) 0 March 7th 07 02:21 AM
Hyperlink from Internet Explorer to Excel Ian West Excel Discussion (Misc queries) 0 July 20th 05 02:25 PM


All times are GMT +1. The time now is 01:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"