|
Изменение громкости звуков в Windows средствами Delphi
Вот представляю сразу листинг)
uses MMSystem;
function GetWaveVolume: DWord; var Woc : TWaveOutCaps; Volume : DWord; begin result:=0; if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then begin if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then begin WaveOutGetVolume(WAVE_MAPPER, @Volume); Result := Volume; end; end; end;
procedure SetWaveVolume(const AVolume: DWord); var Woc : TWaveOutCaps; begin if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then begin if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then WaveOutSetVolume(WAVE_MAPPER, AVolume); end; end;
procedure TForm1.Button1Click(Sender: TObject); begin Beep; end;
procedure TForm1.Button2Click(Sender: TObject); var LeftVolume: Word; RightVolume: Word; begin LeftVolume := StrToInt(Edit1.Text); RightVolume := StrToInt(Edit2.Text); SetWaveVolume(MakeLong(LeftVolume, RightVolume)); end;
procedure TForm1.Button3Click(Sender: TObject); begin Caption := IntToStr(GetWaveVolume); end; |
Категория: Примеры на Delphi7 | Добавил: DelphiAiX (09.10.2011)
|
Просмотров: 2095
| Рейтинг: 4.0/1 |
Добавлять комментарии могут только зарегистрированные пользователи. [ Регистрация | Вход ]
|
|