Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to display 16 or 256 color cursors in Delphi ?

Posted on 1997-09-21
15
Medium Priority
?
458 Views
Last Modified: 2011-09-20
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
0
Comment
Question by:Levente
  • 6
  • 6
  • 2
  • +1
15 Comments
 

Author Comment

by:Levente
ID: 1345731
Edited text of question
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345732
How do you use the LoadCursor function? Can you give that piece of code, so I can look at it?
0
 
LVL 1

Expert Comment

by:sassas081597
ID: 1345733
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Levente
ID: 1345734
Here is the code:

var crHand = 10;

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

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

Author Comment

by:Levente
ID: 1345735
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
 
LVL 1

Expert Comment

by:sassas081597
ID: 1345736
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345737
Hi All.
How can you create cursor with 16 or 256 colors. It is impossible !!!.

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345738
Hi. Are you there ?

Answer It is impossible to create STandard cursor with more than two colors.
0
 

Author Comment

by:Levente
ID: 1345739
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345740
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345741
Can you describe how Your 16-colors cursor was created ?
0
 

Author Comment

by:Levente
ID: 1345742
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345743
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
 
LVL 3

Accepted Solution

by:
mirek071497 earned 600 total points
ID: 1345744
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
 

Author Comment

by:Levente
ID: 1345745
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

578 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