社区
C++ Builder
帖子详情
请问如何用TMEDIAPLAYER实现自动播放VCD啊?
SODATEA
2003-09-30 01:50:33
最好STEP BY STEP
小弟先谢过
...全文
57
4
打赏
收藏
请问如何用TMEDIAPLAYER实现自动播放VCD啊?
最好STEP BY STEP 小弟先谢过
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ljianq
2003-09-30
打赏
举报
回复
监视CD-ROM,发现VCD则播放。
zihan
2003-09-30
打赏
举报
回复
不好意思.刚才把两个东西帖错地方了.
监视光驱中是否有光盘
拦截消息WM_DEVICECHANGE即可!
//响应该消息
procedure Tform1.WMDEVICECHANGE(var msgx :Tmessage);
const
DBT_DEVICEARRIVAL=$8000;
DBT_DEVICEREMOVECOMPLETE=$8004;
begin
inherited;
case msgx.WParam of
DBT_DEVICEARRIVAL:Caption :='有了!';
DBT_DEVICEREMOVECOMPLETE:Caption :='取走了';
end;
end;
判断光驱中的Audio cd
function IsAudioCD(Drive : char) : bool;
var
DrivePath : string;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
VolumeName : string;
begin
Result := false;
DrivePath := Drive + ':\';
if GetDriveType(PChar(DrivePath)) <> DRIVE_CDROM then exit;
SetLength(VolumeName, 64);
GetVolumeInformation(PChar(DrivePath),
PChar(VolumeName),
Length(VolumeName),
nil,
MaximumComponentLength,
FileSystemFlags,
nil,
0);
if lStrCmp(PChar(VolumeName),'Audio CD') = 0 then result := true;
end;
function PlayAudioCD(Drive : char) : bool;
var
mp : TMediaPlayer;
begin
result := false;
Application.ProcessMessages;
if not IsAudioCD(Drive) then exit;
mp := TMediaPlayer.Create(nil);
mp.Visible := false;
mp.Parent := Application.MainForm;
mp.Shareable := true;
mp.DeviceType := dtCDAudio;
mp.FileName := Drive + ':';
mp.Shareable := true;
mp.Open;
Application.ProcessMessages;
mp.Play;
Application.ProcessMessages;
mp.Close;
Application.ProcessMessages;
mp.free;
result := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not PlayAudioCD('D') then
ShowMessage('Not an Audio CD');
end;
zihan
2003-09-30
打赏
举报
回复
监视光驱中是否有光盘
拦截消息WM_DEVICECHANGE即可!
//响应该消息
procedure Tform1.WMDEVICECHANGE(var msgx :Tmessage);
const
DBT_DEVICEARRIVAL=$8000;
判断光驱中的Audio cd
function IsAudioCD(Drive : char) : bool;
var
DrivePath : string;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
VolumeName : string;
begin
Result := false;
DrivePath := Drive + ':\';
if GetDriveType(PChar(DrivePath)) <> DRIVE_CDROM then exit;
SetLength(VolumeName, 64);
GetVolumeInformation(PChar(DrivePath),
PChar(VolumeName),
Length(VolumeName),
nil,
MaximumComponentLength,
FileSystemFlags,
nil,
0);
if lStrCmp(PChar(VolumeName),'Audio CD') = 0 then result := true;
end;
function PlayAudioCD(Drive : char) : bool;
var
mp : TMediaPlayer;
begin
result := false;
Application.ProcessMessages;
if not IsAudioCD(Drive) then exit;
mp := TMediaPlayer.Create(nil);
mp.Visible := false;
mp.Parent := Application.MainForm;
mp.Shareable := true;
mp.DeviceType := dtCDAudio;
mp.FileName := Drive + ':';
mp.Shareable := true;
mp.Open;
Application.ProcessMessages;
mp.Play;
Application.ProcessMessages;
mp.Close;
Application.ProcessMessages;
mp.free;
result := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not PlayAudioCD('D') then
ShowMessage('Not an Audio CD');
end;
DBT_DEVICEREMOVECOMPLETE=$8004;
begin
inherited;
case msgx.WParam of
DBT_DEVICEARRIVAL:Caption :='有了!';
DBT_DEVICEREMOVECOMPLETE:Caption :='取走了';
end;
end;
SODATEA
2003-09-30
打赏
举报
回复
最好STEP BY STEP
谢谢先……
具体代码的用法,越简单越好
Delphi-T
MediaPlayer
和TTrackBar的使用
在Delphi编程环境中,T
MediaPlayer
和TTrackBar是两个非常重要的组件,它们分别用于音频和视频的播放控制以及音量调节。在这个实例中,我们将深入探讨如何有效地利用这两个组件来创建一个用户友好的多媒体应用程序。 ...
Delphi使用
MediaPlayer
控件
在本文中,我们将深入探讨如何在Delphi编程环境中使用
MediaPlayer
控件来
实现
音频播放功能。Delphi是一款强大的可视化开发工具,常用于创建Windows应用程序。
MediaPlayer
控件是Delphi提供的一种集成多媒体播放功能的...
播放多媒体文件(c++builder)
在这个主题下,我们将深入探讨如何使用C++Builder来
实现
多媒体文件的播放。 1. **多媒体框架**:C++Builder通常依赖于第三方库来处理多媒体播放,例如Borland的VCL(Visual Component Library)框架中的...
Position属性
实现
播放进度条(Delphi)..rar
在Delphi编程环境中,`Position`属性通常与多媒体播放控件相关,如T
MediaPlayer
或TAudioPlayer等组件。这些组件允许开发者控制音频或视频的播放,包括播放、暂停、停止以及调整播放进度。`Position`属性就是用来设置...
自制MP3播放器 (T
MediaPlayer
/BmpShape)
BmpShape控件只能用在TForm容器上3. BMP文件可以是256色或者24位色4。大块背景色必须和背景色绝对相等才能获得正常效果}interfaceuses Forms,Windows, Messages, SysUtils, Classes, Controls, ExtCtrls,Graphics;...
C++ Builder
13,871
社区成员
102,694
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章