Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Changing mouse cursors in XE7


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Oct 12, 2015 2:32 PM Last Post By: Bill Coe
Bill Coe

Posts: 4
Registered: 5/10/98
Changing mouse cursors in XE7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 9, 2015 4:29 PM
I have a D2010 application that I am converting to XE7 on Windows7. I have everything working except the ability to change the mouse pointers. I use a set of 4 new pointers that I assign to the screen.cursors array with a series of statements:

Screen.Cursors[crDuplex] := LoadCursorA(HInstance, 'DUPLEX');

Then I assign the cursor property of the image with the new pointer: image.cursor := crDuplex;

When I move the mouse over the image component it is supposed to change to the Duplex cursor. It works perfectly in D2010 but XE7 seems to completely ignore the cursor property.
I am using the latest version of Graphics32 for my image container, specifically TImgView32.

Update: I found that XE7 will not accept the original .res file that I used in D2010. When I try to edit the current one to add the new cursors I get the error:
[dcc32 Error] E2161 Error: RLINK32: Unsupported 16bit resource in file "D:\Project\Program.res"

How does one create the appropriate cursor resource in a .res file?

Edited by: Bill Coe on Oct 11, 2015 12:38 PM

Edited by: Bill Coe on Oct 12, 2015 9:44 AM
Fixed it.The special cursors need to be in a special .res file containing only a cursor group. This is added by the compiler directive {$R cursor.res}. It appears that the program .res file is rebuilt every time the code is compiled or built.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Changing mouse cursors in XE7 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 12, 2015 11:49 AM   in response to: Bill Coe in response to: Bill Coe
Bill wrote:

It appears that the program .res file is rebuilt every
time the code is compiled or built.

Yes, and that has always been the case in every version of Delphi. You should
never add custom resources to the project's main .res file as they will get
lost. Always add custom resources to your own .rc/.res files instead.

--
Remy Lebeau (TeamB)
Bill Coe

Posts: 4
Registered: 5/10/98
Re: Changing mouse cursors in XE7 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 12, 2015 2:32 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Bill wrote:

It appears that the program .res file is rebuilt every
time the code is compiled or built.

Yes, and that has always been the case in every version of Delphi. You should
never add custom resources to the project's main .res file as they will get
lost. Always add custom resources to your own .rc/.res files instead.

--
Remy Lebeau (TeamB)

Thanks. It's been a long time since I worked on this program from the D2010 and I did not have a special resource file. Don't know what's going on but it works and I'm not going back.

Bill
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02