ضع زر جديد والصق الكود التالي بداخله ونفذ
type
TVolumeRec = record
case Integer of
0: (LongVolume: Longint);
1: (LeftVolume, RightVolume : Word);
end;
const DeviceIndex=5
{0:Wave
1:MIDI
2:CDAudio
3:Line-In
4:Microphone
5:Master
6:PC-loudspeaker}
procedure SetVolume(aVolume:Byte);
var Vol: TVolumeRec;
begin
Vol.LeftVolume := aVolume shl 8;
Vol.RightVolume:= Vol.LeftVolume;
auxSetVolume(UINT(DeviceIndex), Vol.LongVolume);
end;
function GetVolume:Cardinal;
var Vol: TVolumeRec;
begin
AuxGetVolume(UINT(DeviceIndex),@Vol.LongVolume);
Result:=(Vol.LeftVolume + Vol.RightVolume) shr 9;
end;لاتنسى اتضيف MMSystem في uses