Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
Member Area
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Become a Member
-Why sign up!
-Chat Online!
-Indexes NEW!!
-Build your resume
-Find a job
-Post a job
-Resume Search
-Link to us
Visit Embarcadero
Embarcadero Community
How to Play an AVI file at full screen 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
Delphi 5.x
User Rating
No Votes
# Votes
DSP, Administrator
Reference URL:
			Author: Tomas Rutkauskas

Using the TMediaPlayer to play AVI is rather slow. When I play the same movies in 
the Windows mediaplayer everything works fine. I tried to import the TActiveMovie 
ActiveX control in Delphi 5 but then I get an error message when I want to compile 
my program. I can't even delete the control from my form. Is there another "easy" 
way to play AVI from Delphi without the delays from MCI?


This code plays an AVI movie (in full screen). It links directly to the MCI devices 
of Windows.So it should be as fast as possible.

1   procedure TForm1.Button1Click(Sender: TObject);
2   const
3     longName: PChar = 'f:\media\ANIM1.MPG'; {Your complete FileName}
4   var
5     ret, shortName: PChar;
6     err: DWord;
7   begin
8     {Getting the short Name (8:3) of selected file}
9     shortName := strAlloc(521);
10    GetShortPathName(longName, shortname, 512);
11    {Sending a close Command to the MCI}
12    ret := strAlloc(255);
13    err := mciSendString(pchar('close movie'), 0, 0, 0);
14    {No error check because at the first call there is no MCI device to close}
15    {Open a new MCI Device with the selected movie file}
16    err := mciSendString(pchar('open ' + shortName + ' alias movie'), 0, 0, 0);
17    shortName := nil;
18    {If an Error was traced then display a MessageBox with the mciError string}
19    if err <> 0 then
20    begin
21      mciGetErrorString(err, ret, 255);
22      messageDlg(ret, mtInformation, [mbOk], 0);
23    end;
24    {Sending the "play fullscreen command to the Windows MCI}
25    err := mciSendString(pchar('play movie fullscreen'), 0, 0, 0);
26    {Use the following line instead of the above one if you want to play 
27  	it in screen mode}
28    err := mciSendString(pchar('play movie'), 0, 0, 0);
29    {If an Error was traced then display a MessageBox with the mciError string}
30    if err <> 0 then
31    begin
32      mciGetErrorString(err, ret, 255);
33      messageDlg(ret, mtInformation, [mbOk], 0);
34    end;
35    ret := nil;
36  end;

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


Share this page
Download from Google

Copyright © Mendozi Enterprises LLC