使用如下代码可调整MicroPhone的音量
uses
MMSystem;
function GetLineInHandle(AudioType : integer) : integer;
var
i : integer;
AudioCaps : TAuxCaps;
begin
result := 0;
for i := 0 to auxGetNumDevs - 1do
begin
auxGetDevCaps(i, @AudioCaps, sizeof(AudioCaps));
if AudioCaps.wTechnology = AudioType then
begin
Result := i;
Break;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
v : DWORD;
begin
AuxGetVolume(GetLineInHandle(AUXCAPS_CDAUDIO), @v);
Edit1.Text := IntToStr(LoWord(v));
Edit2.Text := IntToStr(HiWord(v));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
v : DWORD;
begin
v := MakeLong(Word(StrToInt(Edit1.Text)),
Word(StrToInt(Edit2.Text)));
AuxSetVolume(GetLineInHandle(AUXCAPS_CDAUDIO), v);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
v : DWORD;
begin
AuxGetVolume(GetLineInHandle(AUXCAPS_AUXIN), @v);
Edit3.Text := IntToStr(LoWord(v));
Edit4.Text := IntToStr(HiWord(v));
end;
procedure TForm1.Button4Click(Sender: TObject);
var
v : DWORD;
begin
v := MakeLong(Word(StrToInt(Edit3.Text)),
Word(StrToInt(Edit4.Text)));
AuxSetVolume(GetLineInHandle(AUXCAPS_AUXIN), v);
end;