Solved

How include animated cursor in EXEcutable file?

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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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…

688 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