Solved

How include animated cursor in EXEcutable file?

Posted on 1997-07-22
5
207 Views
Last Modified: 2013-11-18
I have a problem. I've created an animated cursor that I want to incorporate in one of my Delphi programs (to use instead of the hourglass). I don't want the .ANI file to ship with the program, the cursor should be embedded.
   Do I have to create a .RES (resource file) with the cursor in it, and if that is the case, how do I put the .ANI file in the .RES? (Does Delphi come with a resource editor?)
   If not, do anybody know where to download a resource editor that can fulfill my request? Or can I easily solve the problem some other way?
   I use Delphi 2.01!

Thanks!

//Daniel Persson, Malmoe, Sweden
0
Comment
Question by:Dippen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 

Author Comment

by:Dippen
ID: 1339513
Edited text of question
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1339514
Får du inget bättre svar än att du kan använda "Microsofts Developer Studio" så kan du skicka .res-filen + resurserna så fixar jag det åt dig på 5 röda.

john.johansson@era.ericsson.se

/// John

0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1339515
1. By the Image Editor which comes with Delphi, create a new resource file on the same directory of the project. Name it as test.res.
2. Draw, say 8 cursors in this file. Each one of them represents a deferent position(angle) of the hourglass.
3. Name these cursors as 'Cursor_1' to... 'Cursor_8'.
4. Open a new Project. In the project file write:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}
{$test.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

5.Place a button and editbox on the form.
6. Write the following code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  screen.cursors[1]:=LoadCursor(hInstance, pChar('CURSOR_1'));
  .
  .
  .
  screen.cursors[8]:=LoadCursor(hInstance, pChar('CURSOR_8'));

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  DestroyCursor(Screen.Cursors[1]);
  .
  .
  .
  DestroyCursor(Screen.Cursors[8]);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Cursor:=strtoint(edit1.text);
end;

end.

7. When you enter a number between 1 to 8 in the editbox and then click the button then the form's default cursor will change according to the number you typed.
8. For your purpose i think you should use a timer.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1339516
There is also an example Torry's Delphi Pages:
http://carbohyd.siobc.ras.ru/torry/
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1339517
correction:
you should write:
{$R *.RES}
{$R test.res}
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 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