Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How include animated cursor in EXEcutable file?

Posted on 1997-07-22
5
Medium Priority
?
221 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

618 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