我在Windows 7機器上靜音麥克風時出現問題。但是我發現的所有代碼都沒有運行,它沒有做任何事情。是否使用C#代碼爲Windows 7機器完成。我只需要一個開/關解決方案。 DDL文件也適用於Win x64bit。但我的事情,我創造了一個錯誤的另一個地方。在Windows 7上靜音麥克風
mixers.Recording.Lines.GetMixerFirstLineByComponentType(
MIXERLINE_COMPONENTTYPE.SRC_MICROPHONE).Volume = 0;
if (!mediaElement1.CheckAccess()) mediaElement1.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate { mediaElement1.Play(); });
if (MessageBox.Show("Incoming Call from: " + string.Format(e.RemoteParticipant), "Video Chat Call", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
mixers.Recording.Lines.GetMixerFirstLineByComponentType(
MIXERLINE_COMPONENTTYPE.SRC_MICROPHONE).Volume = 1;
if (!mediaElement1.CheckAccess()) mediaElement1.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate { mediaElement1.Stop(); });
_currentConversation.StartVideo();
}'
如果if (MessageBox.Show("Incoming Call from: " + string.Format(e.RemoteParticipant), "Video Chat Call", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
發生錯誤,並說{ 「算術運算導致溢出。」}
什麼是'e.RemoteParticipant'?如果你把這個string.Format放在它自己的行上,並將它保存到一個變量中,那麼錯誤會發生在那行上呢?事實上,我沒有看到只有一個參數的'string.Format'的重載,是一個擴展方法嗎? – 2012-03-22 14:21:06
可能的重複http://stackoverflow.com/a/3046715/285594 – YumYumYum 2017-01-31 09:16:48