PDA

View Full Version : ولوم ویندوز تو دلفی



hassan1365
پنج شنبه 05 آذر 1383, 20:23 عصر
سلام
من ولوم میندوز رو با api باز کردم.فقط کم و زیاد کردنشو بلد نیستم.البته میخوام فرم volume control رو نیاره ها.یعنی مثل jet-audio ولوم ویندوز رو بدون اینکه فرمی بیاره کم و زیاد کنه.


موفق باشید.

vcldeveloper
شنبه 07 آذر 1383, 03:41 صبح
uses MMSystem;

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;


از سایت about.delphi.com