Link to home
Start Free TrialLog in
Avatar of Levente
Levente

asked on

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
Avatar of Levente
Levente

ASKER

Edited text of question
How do you use the LoadCursor function? Can you give that piece of code, so I can look at it?
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.
Avatar of Levente

ASKER

Here is the code:

var crHand = 10;

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

(...)
  Screen.Cursors[crHand]:=LoadCursor(hInstance,'HAND');
(...)
Avatar of Levente

ASKER

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.
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
Hi All.
How can you create cursor with 16 or 256 colors. It is impossible !!!.

Hi. Are you there ?

Answer It is impossible to create STandard cursor with more than two colors.
Avatar of Levente

ASKER

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 " ?

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
Can you describe how Your 16-colors cursor was created ?
Avatar of Levente

ASKER

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.
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
ASKER CERTIFIED SOLUTION
Avatar of mirek071497
mirek071497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Levente

ASKER

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