Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2002, 08:51 AM
Derek Derek is offline
Senior Member
 
Join Date: Jun 2002
Posts: 559
Default Adding custom cursors to your program

Hi, I want to know: If I've got the cursor, 'hand.cur', how do I use it in my program. I only get the Windows default cursors to choose from.

Thanx alot!!!!
Derek
Reply With Quote
  #2  
Old 06-08-2002, 08:58 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Adding custom cursors to your program

Try this code in the OnCreate event of your form:

const
crMyCursor = 5;
begin
Screen.Cursors[crMyCursor] := LoadCursorFromFile('hand.cur');
Cursor := crMyCursor;
end;


Hope that helps...

gLes

"If you read your bible you might have seen that it was damnation without relief..."
/Rowan Atkinson/
Reply With Quote
  #3  
Old 06-08-2002, 09:14 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Adding custom cursors to your program

Or if you don't want to store the cursor in an external file then create a .RC file in Notepad with the name for example MyCursor.rc with this content:

MyCursor CURSOR "hand.cur"

Now...in the C:\Program Files\Borland\Delphi 5\Program Files\Bin directory (something like that) you'll find a program called brcc32.exe...copy this file to your project's directory...now run this from some command line (in the project's dir):

brcc32 MyCursor.rc

There will be a file created named MyCursor.RES...now...add this line to the unit you are working in:

{$R MyCursor.RES}

Now you can use this code to load the cursor:

const
crMyCursor = 5;
begin
Screen.Cursors[crMyCursor] := LoadCursor(hInstance, 'MyCursor');
Cursor := crMyCursor;
end;


Hope that helps...

gLes

"If you read your bible you might have seen that it was damnation without relief..."
/Rowan Atkinson/
Reply With Quote
  #4  
Old 04-14-2007, 10:24 AM
Danny90001 Danny90001 is offline
Member
 
Join Date: Apr 2007
Posts: 46
Default RE: Adding custom cursors to your program

i had some trouble getting a cursor to work and this has helped but i cannot have an animated cursor

why must the cursor used be static?

can you use an animated one?

in need of help, Danny
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 02:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.