unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MMSystem, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetVolume: DWord;
var
Woc: TWAVEOUTCAPS;
Volume : DWord;
begin
Result:=0;
if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then
if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
begin
WaveOutGetVolume(WAVE_MAPPER, @Volume);
Result := Volume;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
vol: longint;
begin
vol:=GetVolume;
Label1.Caption:=IntToStr(vol shr 16);
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, MMSystem;
type
TForm1 = class(TForm)
Panel1: TPanel;
ListBox1: TListBox;
Button1: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
cap: TWaveInCaps;
begin
for i := 0 to waveInGetNumDevs do
begin
waveInGetDevCaps(i, Addr(cap), SizeOf(cap));
ListBox1.Items.Add(cap.szPname )
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
vol : longint;
begin
waveOutGetVolume( ListBox1.ItemIndex, @Vol);
Label1.Caption:=IntToStr(vol shr 16);
end;
end.