如何 1、更改系统 Playing 主声音音量(注意:是要求主声音,也就是说,更改的是系统右下角的喇叭的音量,而不是单单更改 WAVE 或 CD 或 MIDI 等的音量。),及2、如何将系统音量设为静音,要求设后右下角的喇叭为禁止,3、及如何知道系统目前为静音状态?
解决方案 »
- 得分最容易的贴子!
- 如何在一个服务器访问另一个服务器?
- http://www.monlif.com
- 那有‘未名码头’资料包下载的,我到他的主业怎么没找到
- pilicat(delphi迷) :请进来回复一下,刚才操作错误,没有给你分.
- RQDBTEXT怎样换行
- 高手请进,报表问题,100分相送,在线等待,在线加分,分多的是,还可在加
- 牛虻呼叫老鱼,牛虻呼叫老鱼,牛虻呼叫老鱼,牛虻呼叫老鱼,牛虻呼叫老鱼,
- 请教TADOStoredProc如何传入Stored Procedure输入参数以及如何获取Stored Procedure输出参数?
- Delphi新手sql数据库简单问题?
- 请问各位高手一个问题。特急。谢谢各位了!我在在线等后!
- 【求 :sql6.5 下载地址。。。】
Windows, Messages, SysUtils, Variants, Classes; function GetWaveVolumeLeft: Word;
function GetWaveVolumeRight: Word;
procedure GetWaveVolume(var Left, Right: WORD);
procedure SetWaveVolume(const Left, Right: WORD);
function SupportsLAndRVolume: boolean;implementation
uses mmsystem;{$R-}function _GetWaveVolume: DWORD;
var
Woc : TWAVEOUTCAPS;
Volume : DWORD;
hwo : UINT;
begin
result := 0; hwo := WAVE_MAPPER;
if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
if (Woc.dwSupport and WAVECAPS_VOLUME) = WAVECAPS_VOLUME then
begin
if WaveOutGetVolume(hwo, @Volume) = MMSYSERR_NOERROR then
Result := Volume;
end;
end;procedure _SetWaveVolume(const AVolume: DWORD);
var
Woc : TWAVEOUTCAPS;
hwo : UINT;
begin
hwo := WAVE_MAPPER; if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
if (Woc.dwSupport and WAVECAPS_VOLUME) = WAVECAPS_VOLUME then
WaveOutSetVolume(hwo, AVolume);
end;function GetWaveVolumeLeft: Word;
var
d : DWORD;
begin
d := _GetWaveVolume;
result := LOWORD(d);
end;function GetWaveVolumeRight: Word;
var
d : DWORD;
begin
d := _GetWaveVolume;
result := HIWORD(d);
end;procedure GetWaveVolume(var Left, Right: WORD);
var
d : DWORD;
begin
d := _GetWaveVolume;
Left := LOWORD(d);
Right := HIWORD(d);
end;
procedure SetWaveVolume(const Left, Right: WORD);
var
d : DWORD;
begin
d := MAKELONG(Left, Right);
_SetWaveVolume( d );
end;function SupportsLAndRVolume: boolean;
var
Woc : TWAVEOUTCAPS;
Volume : DWORD;
hwo : UINT;
begin
result := false; hwo := WAVE_MAPPER;
if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
result := (Woc.dwSupport and WAVECAPS_LRVOLUME) = WAVECAPS_LRVOLUME;
end;end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls,MMSystem, Buttons;type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
TrackBar1: TTrackBar;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.BitBtn1Click(Sender: TObject);
var
ls:integer;
begin
ls:=Self.TrackBar1.Position*255;
WaveOutSetVolume(ls,0);
end;procedure TForm1.BitBtn2Click(Sender: TObject);
var
ls:integer;
begin
ls:=Self.TrackBar1.Position*255;
WaveOutSetVolume(ls,65535);
end;end.
在我的程序拉, 能同時見到變化, 但現在在外地, 沒法拷代碼給你!