檢查聲卡是否安裝
uses mmsystem;
function Soundkarte:Boolean;
begin
Result := WaveOutGetNumDevs >
end;
檢測聲卡存在
如果你是做一些多媒體播放器之類的程序時
procedure TForm
var i
begin
i
if i<= then
label
end
控制聲音音量
當你做一個多媒體播放器時
procedure TForm
var Wave:string;
begin
Wave:=
waveoutsetvolume(
strtoint(Wave));
end;
獲得和控制音量
unit uMain;
interface
uses
Windows
Messages
SysUtils
Classes
Controls
Forms
Dialogs
ExtCtrls
StdCtrls
mmsystem; //You must add this in the uses line
type
TForm
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
myvolume: array[
{ Public declarations }
end;
var
Form
implementation
{$R *
procedure TForm
var
Count
i: integer;
begin
Count := auxGetNumDevs;
for i :=
begin//The i is the device: I
auxgetvolume(i
addr(myvolume[i])); //Gets the values that the user has set
auxsetvolume(i
longint(
end; //The reason for the
end;
procedure TForm
var
Count
i: integer;
begin
Count := auxGetNumDevs;
for i :=
begin
auxsetvolume(i
myvolume[i]); //Sets the volume back to the users old settings
end;
end;
From:http://tw.wingwit.com/Article/program/Delphi/201311/24686.html