Solved

How include animated cursor in EXEcutable file?

Posted on 1997-07-22
5
197 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

911 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

22 Experts available now in Live!

Get 1:1 Help Now