How to display 16 or 256 color cursors in Delphi ?

I have a 16 color cursor saved as a resource in a .res file. Somewhere in my code I use LoadCursor API call to load my cursor. But when I try to use my nice cursor it is displayed black-and-white.

Am I doing something wrong ? How to display cursors more
than 2 colors ?

Any help, suggestions are welcome.

Levente
slv@mcse.hu
LeventeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LeventeAuthor Commented:
Edited text of question
0
ZifNabCommented:
How do you use the LoadCursor function? Can you give that piece of code, so I can look at it?
0
sassas081597Commented:
Hi!
I don't know why do you have that trouble, but I can recommend you to use LoadImage or LoadCursorFromFile functions instead of LoadCursor. They do the same but can be adjusted more presizely.
You should also check if your cusror is painted and stored correctly.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

LeventeAuthor Commented:
Here is the code:

var crHand = 10;

{$R BITMAPS.RES}    { This file contains the HAND cursor }

(...)
  Screen.Cursors[crHand]:=LoadCursor(hInstance,'HAND');
(...)
0
LeventeAuthor Commented:
sassas,

Is LoadCursorFromFile a win16 Api call ? My Delphi doesn't seem to compile this. (I have Delphi 1 under win95.) My program need to work under win 3.x as well.
0
sassas081597Commented:
Hi Levente
This function is used under win32s  - so it is 32Bit and its impossible to use it under D1.
And again, TRY TO REPAINT YOUR CURSOR. May be it was stored incorrectly.
Best wishes
0
mirek071497Commented:
Hi All.
How can you create cursor with 16 or 256 colors. It is impossible !!!.

0
mirek071497Commented:
Hi. Are you there ?

Answer It is impossible to create STandard cursor with more than two colors.
0
LeventeAuthor Commented:
Hi Mirek,

Are you sure it is impossible to create a 16 color cursor !? I created one,  and I can assign to my default Win95 mouse cursor. And it works ! And I can see  all the 16 colors !!! Is it possible that Delphi 1 can't handle color  cursors ?! What do you mean by " it is impossible to create standard cursor with
more than two colors " ?

0
mirek071497Commented:
When You run ImageEditor or ResourceWorkshop You can create cursor, but only with 2 colors. I don't know how can you create you'r 16colors Cursor
0
mirek071497Commented:
Can you describe how Your 16-colors cursor was created ?
0
LeventeAuthor Commented:
With Microangelo Stuido I created a new 16 color cursor. Then I drrew my cursor and saved it as a cursor resource. That's all.
0
mirek071497Commented:
I was trying to create cursor indirect and i found so function CreateCursor can't create colored cursor however i found function CreateIconIndirect, which can create cursor with more colors. Unfortunatelly I can't get this working and I think so this may depend on SVGA chip or I have some mistakes. Can you mail to me your 16colored cursor for testing ? This can help me to help you.

mirek@izabell.itcomp.tpnet.pl
0
mirek071497Commented:
Hi
Sorry for the long time, and thank you for the cursor.

I try load the cursor and all works fine. Mayby you have any mistake. Here is my code :

{ this is to loading from *.res files }
procedure TForm1.Button1Click(Sender: TObject);
begin
  Screen.Cursors[1] := LoadCursor( HInstance, PChar('CURSOR_1'));
  Screen.Cursor := 1;
end;

uses
  Windows;

{ this is to loading from *.cur files }
procedure TForm1.Button2Click(Sender: TObject);
begin
  Screen.Cursors[1] := LoadImage( 0, PChar('D:\FEL.CUR'), IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE );
  Screen.Cursor := 1;
end;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeventeAuthor Commented:
Hi Mirek,

Sorry for the delay. and thank you for your code. I gave it a try and I had the  following result: using Delphi 1 or 2 my cursor *still* showed black-and-white. But when I compiled your code
in *Delphi 3* everything DID work. (I suppose you used Delphi 3, too) IMHO this behaviour must be a bug  in Delphi 1 and 2. This is not the first time I encountered  a weird Delphi bug ...

Thanks again,
Levente

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.