الشبكة العربية لمطوري الألعاب

  hani safa مشاركة 1

Hi there ,
Is there any body know how can I mute all sounds in windows 2000 ,
I’m doing a program that used Delphi media player component to play a avi file and I want to mute the sound at a certain time
Thanks

The deference between madness and geniuses is success

خبير مشرف مؤيد مارديني مشاركة 2

Greetings Mr.Hani,
At first, please use "Insert English Text" button to format your post as left-to-right☺
I don't use Delphi, but I know a lot of visual basic, when you use "WaveOutSetVolume" library ("Winmm.dll") you can set the value to 0, in this case the sound will be mute, and if you want to return the volume to its original value, you must set the value to 65535, OK?
Anyway, I use this code :
Private Declare Function WaveOutSetVolume Lib "Winmm" _
(ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Sub ChangeVal()
    Dim TempVal As String
    TempVal = WaveOutSetVolume(0, CLng(65535))
End Sub

I hope this information helped you,
Moayad Mardini

Moayad Mardini,
MSDN Forums Moderator

محترف مشرف عبد اللطيف حاجي علي مشاركة 3

I don't think that you can call waveOutSetVolume with a null device handle... You need first to create one (or use the one already created)... Also calling it with a 65535 value won't return the volume to its original state but instead it would set it to maximum (Try checking the MSDN)

And Hani, it would be much better if you tell us more about your control, like what output method it is using (DirectSound, waveout or some other external library)... Whatever it's using it should give a handle to the instance of the object it created that you can manipulate (Although, I don't think that any decent "media player" component won't contain a volume control function... Try googling for your control)

عبد اللطيف حاجي علي
مبرمج
In|Framez

خبير مشرف مؤيد مارديني مشاركة 4

Thanks Abdo for this info!, for the original value, I suggest to save it in a variable after calling "WaveOutGetVolume" function.

Moayad Mardini

Moayad Mardini,
MSDN Forums Moderator