Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Adding an AVI in your EXE File Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
24-Jan-03
Category
Multimedia
Language
Delphi 2.x
Views
91
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler

Adding an AVI in your EXE File

Answer:

In Notepad type or some other simple text editor type:

MyAvi AVI "some.avi"

or

100 AVI "some.avi"

depending on how you want to reference the identifier.  You will want to know 
whether it is referenced by a resource name or a resource ID when you write the 
code to play the AVI.

Save the file with a .RC extension

You will be using the Animate Component to play the file, therefore the same rules 
apply, like no sound can be with the AVI.

Use Borland's Resource Compiler: BRCC32.EXE to convert the file to a .RES file.  At 
the dos prompt type the following:

brcc32 myfile.rc

This is some code to play an animation using the Resource Name:

A
1   nimate.ResHandle := 0;
2   Animate.ResName := 'MyAvi';
3   Animate.Active := True;


To stop an animation, call the Stop method.

Place the following code to add your resource file into your executable.

{$R MYFILE.RES}

A sample file is listed below of how this would work correctly:

4   unit AviResU;
5   
6   interface
7   
8   uses
9     Forms, ComCtrls, StdCtrls, Classes, Controls;
10  
11  type
12    TForm1 = class(TForm)
13      PlayBtn: TButton;
14      Animate: TAnimate;
15      StopBtn: TButton;
16      procedure PlayBtnClick(Sender: TObject);
17      procedure StopBtnClick(Sender: TObject);
18    private
19      { Private declarations }
20    public
21      { Public declarations }
22    end;
23  
24  var
25    Form1: TForm1;
26  
27  implementation
28  
29  {$R *.DFM}
30  {$R AVIRESRC.RES}
31  
32  procedure TForm1.PlayBtnClick(Sender: TObject);
33  begin
34    Animate.ResHandle := 0;
35    Animate.ResName := 'TurboGuy';
36    Animate.Active := True;
37    PlayBtn.Enabled := False;
38    StopBtn.Enabled := True;
39  end;
40  
41  procedure TForm1.StopBtnClick(Sender: TObject);
42  begin
43    Animate.Stop;
44    PlayBtn.Enabled := True;
45    StopBtn.Enabled := False;
46  end;
47  
48  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC