볼륨조절함수
MMRESULT waveOutSetVolume( HWAVEOUT hwo, DWORD dwVolume );
Parameters
hwo
Handle to an open waveform-audio output device.
This parameter can also be a device identifier.
dwVolume
New volume setting.
The low-order word contains the left-channel volume setting,
and the high-order word contains the right-channel setting.
A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
If a device does not support both left and right volume control,
the low-order word of dwVolume specifies the volume level,
and the high-order word is ignored.
Return Values
Returns MMSYSERR_NOERROR if successful or an error otherwise.
Possible error values include the following.
Value Description MMSYSERR_INVALHANDLE Specified device handle is invalid. MMSYSERR_NODRIVER No device driver is present. MMSYSERR_NOMEM Unable to allocate or lock memory. MMSYSERR_NOTSUPPORTED Function is not supported.
uses MMSystem;
...
...
...
var
원래볼륨: DWORD;
// 시작할 때 원래 볼륨 저장
procedure TForm1.FormCreate(Sender: TObject);
begin
waveOutGetVolume(0, @원래볼륨);
end;
// 볼륨 조절 함수
procedure SetVolume(NewVolume: DWORD);
begin
NewVolume:=MAKEWPARAM(NewVolume, NewVolume);
waveOutSetVolume(0, NewVolume);
end;
// Mute
procedure TForm1.btnMuteClick(Sender: TObject);
begin
SetVolume(0);
end;
// Mute 해제
procedure TForm1.btnRestoreVolumeClick(Sender: TObject);
begin
SetVolume(원래볼륨);
end;
'Delphi' 카테고리의 다른 글
[Delphi] TColor 와 R,G,B 전환하기 (0) | 2009.04.18 |
---|---|
[Delphi] 폰트 스타일 조절 (0) | 2009.04.18 |
[Delphi] 디버그 권한 얻어 OpenProcess (0) | 2009.04.18 |
[Delphi] MS PowerPoint 파일에서 텍스트 추출 (0) | 2009.04.18 |
[Delphi] MS Word 파일에서 텍스트 추출 (0) | 2009.04.18 |