Solved

Screen.Cursor help

Posted on 2004-09-09
8
213 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
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 22

Accepted Solution

by:
Ferruccio Accalai earned 25 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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 25 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ddeman not working in activex 3 103
calling Tcolordialog in dll make the form disappear 8 111
Intraweb download file link ? 1 132
find a node in VST 2 68
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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

18 Experts available now in Live!

Get 1:1 Help Now