Solved

Screen.Cursor help

Posted on 2004-09-09
8
215 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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