Solved

How to display 16 or 256 color cursors in Delphi ?

Posted on 1997-09-21
15
448 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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 150 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 111
How to open a new windows chrome resized and disabled the toolbar? 3 113
Working with hours 3 57
select query - oracle 16 100
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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