C# trackBar ile bilgisayar sesi kısıp açma [YARDIM]
3
●88
- 10-11-2022, 02:10:36[DllImport(winmm.dll)]
public static extern int waveOutGetVolume
(IntPtr hwo, out uint dwVolume);
[DllImport(winmm.dll)]
public static extern int waveOutSetVolume
(IntPtr hwo, uint dwVolume);
// InitializeComponent(); //Altına
uint CurrVol = 0;
waveOutGetVolume(IntPtr.Zero, out CurrVol);
ushort CalcVol = (ushort)(CurrVol & 0x0000ffff);
trackBar1.Value = CalcVol / (ushort.MaxValue / 10);
//Scroll bar'a çift tıklayın;
int NewVolume = ((ushort.MaxValue / 10) * trackBar1.Value);
uint NewVolumeAllChannels = (((uint) NewVolume & 0x0000ffff) | ((uint)NewVolume << 16));
waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);