我的網頁瀏覽器:的Webbrowser禁用所有音頻輸出 - 從網上電臺到YouTube
XAML:
背後C#//...
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
//...
<my:WindowsFormsHost Name="windowsFormsHost"/>
代碼:
System.Windows.Forms.WebBrowser Browser = new System.Windows.Forms.WebBrowser();
windowsFormsHost.Child = Browser;
我的問題是,如何禁用所有音頻輸出。
我發現這一點:
C#:
private const int Feature = 21; //FEATURE_DISABLE_NAVIGATION_SOUNDS
private const int SetFeatureOnProcess = 0x00000002;
[DllImport("urlmon.dll")]
[PreserveSig]
[return: MarshalAs(UnmanagedType.Error)]
static extern int CoInternetSetFeatureEnabled(int featureEntry,
[MarshalAs(UnmanagedType.U4)] int dwFlags,
bool fEnable);
其優良的,但是這個代碼只禁用 「咔嚓」 聲,所以其在這種情況下,一種無用的。
我只是想從我的應用程序100%靜音,根本沒有聲音。
我讀過,在這個瀏覽器中它需要通過Windows聲音來完成,但我不能真正bielieve,我不能在代碼中做到這一點。
不幸的是我錯過了OP問題中有關整個應用程序靜音的部分;我提供了一個賞金,希望得到一個特定於網絡瀏覽器控件的解決方案(因爲我的應用程序有其他音頻來源)。你不會碰巧知道更具針對性的方法嗎?無論哪種方式,這*都*很好地回答了OP問題。 – JYelton
我會看看它。不知道是否可以完成。 – Noseratio
我不認爲這是可能的。我試着將[APPCOMMAND_VOLUME_MUTE](http://stackoverflow.com/questions/154089/mute-windows-volume-using-c-sharp)發送到WebBrowser的整個子窗口樹,最好的結果是全球靜音。 – Noseratio