PDA

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



hassan1365
سه شنبه 09 تیر 1383, 12:55 عصر
سلام
من ولوم ویندوز رو با استفاده از auxgetvolume,auxsetvolume بدست آوردم.
ولی درست کار نمیکنه.

لطفا راهنماییم کنین .

مرسی

پسر خاک
چهارشنبه 10 تیر 1383, 09:50 صبح
سلام



uses
MMSystem;

procedure SetVolume(const volL, volR: Word);
var
hWO: HWAVEOUT;
waveF: TWAVEFORMATEX;
vol: DWORD;
begin
// init TWAVEFORMATEX
FillChar(waveF, SizeOf(waveF), 0);
// open WaveMapper = std output of playsound
waveOutOpen(@hWO, WAVE_MAPPER, @waveF, 0, 0, 0);
vol := volL + volR shl 16;
// set volume
waveOutSetVolume(hWO, vol);
waveOutClose(hWO);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
SetVolume(14000, 14000);
end;

hotice
چهارشنبه 10 تیر 1383, 11:28 صبح
سلام
شاید مثال زیر که از سایت دلفی پیچ پیداکردم هم بدردتان بخورد:

unit uMain;

interface

uses
Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs,
ExtCtrls,StdCtrls, mmsystem; //You must add this in the uses line

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
myvolume: array[0..10] of longint;
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
Count, i: integer;
begin
Count := auxGetNumDevs;

for i := 0 to Count do
begin//The i is the device: I.E. 0=Wav Volume
auxgetvolume(i,addr(myvolume[i])); //Gets the values that the user has set
auxsetvolume(i,longint(9000)*65536+longint(9000)); //Sets the volume very very low
end; //The reason for the 9000*65536 + 9000 is if you wanted to do left and right channels
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
Count, i: integer;
begin
Count := auxGetNumDevs;

for i := 0 to Count do
begin
auxsetvolume(i,myvolume[i]); //Sets the volume back to the users old settings
end;
end;

end.
در صورت کارکرد خبربدهید.
موفق باشید. :)

hassan1365
پنج شنبه 11 تیر 1383, 23:35 عصر
سلام
با یه کمی تغییر درست کار کرد.
دستتون درد نکنه .


مرسی