我在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