用MCI循环播放Wav文件 ( 积分: 100 )

  • 主题发起人 主题发起人 k4-1
  • 开始时间 开始时间
K

k4-1

Unregistered / Unconfirmed
GUEST, unregistred user!
如题。
能给点提示也好。
路过的也帮忙顶一下,因为我发现delphibbs里很少有关于mci的帖子!
 
如题。
能给点提示也好。
路过的也帮忙顶一下,因为我发现delphibbs里很少有关于mci的帖子!
 
好,帮顶



--------签名档---------------------------

比肩国内顶尖源码下载站点 -> 源码我爱你

http://www.source520.com
http://www.source520.net

80G源码电子书免费免注册下载,大量精辟技术文档库随时更新
******************************************************************
附:为了站点持续发展,现有本站近年来收藏的大量大型商业源码低价出售,
详情请进入以下链接查看:
http://www.source520.com/building_delphi.htm

浏览商业代码请从如下URL进入查看实物:
1.商业源码库1: ftp://source520see3:browse@61.152.199.245/
2.商业源码库2: ftp://source520see2:browse@61.152.199.245/
 
我在做大屏幕的控制系统,需要在窗口里显示来自视频卡video口的视频流。厂家提供了一个vb的demo,可是我转成delphi之后就是显示不出来,我也不知道问题出在哪,因为函数返回值都是对的。下面是一部分代码:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, mmSystem, Clipbrd, Menus;
const
CONFIG_BASE = 100;

CONFIG_SOURCE_1 = (CONFIG_BASE + 10);
CONFIG_SOURCE_2 = (CONFIG_SOURCE_1 + 1);
CONFIG_SOURCE_3 = (CONFIG_SOURCE_1 + 2);
CONFIG_SOURCE_4 = (CONFIG_SOURCE_1 + 3);

CONFIG_SOURCE_5 = (CONFIG_SOURCE_1 + 4);
CONFIG_SOURCE_6 = (CONFIG_SOURCE_1 + 5);
CONFIG_SOURCE_MAX = CONFIG_SOURCE_6 ;

MCI_DGV_SETVIDEO_SRC_NTSC = $4000;
MCI_DGV_SETVIDEO_SRC_RGB = $4001;
MCI_DGV_SETVIDEO_SRC_SVIDEO = $4002;
MCI_DGV_SETVIDEO_SRC_PAL = $4003;
MCI_DGV_SETVIDEO_SRC_SECAM = $4004;
MCI_DGV_SETVIDEO_SRC_GENERIC = $4005 ;

CONFIG_TYPE_BASE = (CONFIG_BASE - MCI_DGV_SETVIDEO_SRC_NTSC + 20);
CONFIG_TYPE_NTSC = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_NTSC);
CONFIG_TYPE_RGB = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_RGB);
CONFIG_TYPE_SVIDEO = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_SVIDEO);
CONFIG_TYPE_PAL = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_PAL);
CONFIG_TYPE_SECAM = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_SECAM);
CONFIG_TYPE_GENERIC = (CONFIG_TYPE_BASE + MCI_DGV_SETVIDEO_SRC_GENERIC);

CONFIG_TYPE_MIN = CONFIG_TYPE_NTSC;
CONFIG_TYPE_MAX = CONFIG_TYPE_GENERIC;




type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
property1: TMenuItem;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure property1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
DrvError:LongInt;

implementation

{$R *.dfm}

uses Unit2;

procedure TForm1.FormCreate(Sender: TObject);
begin

//Close overlay left open from a previous run cut short by the debugger
mciSendStringA('close overlay', ' ', 0, 0 );

DrvError := mciSendStringA('open overlay ', ' ', 0, 0);
If DrvError <> 0 then

showmessage('MCI Error code ' + inttoStr(DrvError) + ' when opening device ');

IMage1.Picture.Assign(Clipboard);
DrvError := mciSendString(PChar('window overlay handle ' + inttoStr(self.Handle)), ' ', 0, 0);

If DrvError <> 0 then

showmessage( 'MCI Driver did not get the window handle Error code: ' + inttoStr(DrvError));
end;


procedure TForm1.FormDestroy(Sender: TObject);
begin

DrvError := mciSendString('window overlay handle default', ' ', 0, 0);

If DrvError <> 0 then

showmessage('MCI Error code: ' + inttoStr(DrvError) + ' while handle default ');

DrvError := mciSendString('close overlay', ' ', 0, 0);
If DrvError <> 0 then

showmessage('MCI Error code: ' + inttoStr(DrvError) + ' while handle default ');
end;

他那个vb的实例,formcreate之后就能显示图象了,为什么delphi不行?难道delphi的form和vb的form不一样?
procedure TForm1.property1Click(Sender: TObject);
begin

form2.show;
end;


end.
 
问题自己已经解决了.谢谢了!用了一个timer,MCI_STATUS和MCI_SEEK
 

Similar threads

回复
0
查看
1K
不得闲
I
回复
0
查看
740
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部