Solved

How include animated cursor in EXEcutable file?

Posted on 1997-07-22
5
196 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
  • 3
5 Comments
 

Author Comment

by:Dippen
Comment Utility
Edited text of question
0
 
LVL 4

Expert Comment

by:erajoj
Comment Utility
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
Comment Utility
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
Comment Utility
There is also an example Torry's Delphi Pages:
http://carbohyd.siobc.ras.ru/torry/
0
 
LVL 5

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now