Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Screen.Cursor help

Posted on 2004-09-09
8
Medium Priority
?
230 Views
Last Modified: 2010-04-04
I've got a hyperlink (a Label that has been altered anyway) on my form and I'd like to change the cursor to one representing the cursor that the user has specified for links. However this 'Link Cursor' was only able to be set in windows xp as far as I know. In Delphi6/7 I see no references to any other cursors except the standard 0 to -22 ones. I've tried going out of that range with no luck. Has anyone else been able to get the hyperlink cursor to display?
0
Comment
Question by:Narusegawa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12016270
Yes. Include the cursor you like in your *.res file, load it when your application starts and use that cursor when you're above the link. Unfortunately I don't have Delphi easily available right now so perhaps someone else can show you how...
0
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 100 total points
ID: 12016313
What do you mean with 'Link Cursor' ?
I've always saw a crHandPoint as Hyperlink Cursor....

BTW you can load a custom cursor easly when you want...

The easiest example from Delphi Help:

This example shows how to add custom cursors to an application.  It assumes that a custom cursor with the name NewCursor has been added to the resources (.RES file) of the application. You can add the cursor using the image editor. (Tools | Image Editor)
The following code makes this cursor available to the application via the constant crMyCursor, and sets it as the global cursor to the application.

const

  crMyCursor = 5;
procedure TForm1.FormCreate(Sender: TObject);
begin
  Screen.Cursors[crMyCursor] := LoadCursor(HInstance, 'NewCursor');
  Cursor := crMyCursor;
end;
0
 

Author Comment

by:Narusegawa
ID: 12016346
I want the user to display whatever he or she has set for their hyperlink cursor. Not what I put in the .res file as that beats the object of it. There must be a way of getting it someone, it's a system cursor. It's just not in the list that comes with Delphi and on most webpages.  It's none of the below:

Arrow, Cross, IBeam, UpArrow, Drag, NoDrop, HSplit, VSplit, MultiDrag, SQLWait, No, AppStart, Help, HandPoint or the Size and different Size pointers (SizeAll, SizeNESW, SizeNS, SizeNWSE, SizeWE).

In Windows XP, if you check the 'Pointers' tab you see the list of cursors. At the bottom, after "Alternate Select" is one called "Link Select".
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Narusegawa
ID: 12016390
I've used crHandPoint already and that displays the white hand, however in Windows XP which is what I am using I set a different cursor for that for all programs like IE/Mozilla etc etc.
0
 

Author Comment

by:Narusegawa
ID: 12016520
If I look into HKEY_CURRENT_USER/Control Panel/Cursors and check the value for 'Hand' I see the cursor I chose. Not sure why crHandPoint doesn't use this cursor file though.

Is there a quick way to instead get this registry value if it exists into a variable like Ferrucio said above?

This is my own personal thought on how to get around this problem.
0
 

Author Comment

by:Narusegawa
ID: 12016663
I'm now trying the following but it doesn't come up with anything. The value in CursorPath is : %USERPROFILE%\My Documents\My Themes\Cursors\Premium 1.5\Premium_link.cur : and the file does exist.

const
  crLinkSelect = 5;

procedure TfrmSplash.FormCreate(Sender: TObject);
var
  CursorPath: string;
begin
  CursorPath := GetRegistryData(HKEY_CURRENT_USER,'\Control Panel\Cursors','Hand');
  Screen.Cursors[crLinkSelect] := LoadCursor(HInstance, PChar(CursorPath));
end;

procedure TfrmSplash.lblURLMouseEnter(Sender: TObject);
begin
  FURLColor := lblURL.Font.Color;
  lblURL.Font.Color := $00DD0000;
  Screen.Cursor := crLinkSelect;
end;
0
 
LVL 17

Assisted Solution

by:geobul
geobul earned 100 total points
ID: 12017686
Hi,

Use LoadCursorFromFile API instead of LoadCursor.

Regards, Geo
0
 

Author Comment

by:Narusegawa
ID: 12017769
Thanks, I have it working with LoadCursorFromFile, I just need to now figure out this other API thing at http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21124755.html to finish this off.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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