Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检查用户是否注销时出现异常_C#_Skype - Fatal编程技术网

C# 检查用户是否注销时出现异常

C# 检查用户是否注销时出现异常,c#,skype,C#,Skype,我在检查用户是否注销时遇到异常 代码段: if(skype.CurrentUserStatus == TUserStatus.cusLoggedOut) { MessageBox.Show("Bitte melde dich in Skype an.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); System.Windows.Forms.Application.Exit()

我在检查用户是否注销时遇到异常

代码段:

if(skype.CurrentUserStatus == TUserStatus.cusLoggedOut)
{
    MessageBox.Show("Bitte melde dich in Skype an.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
    System.Windows.Forms.Application.Exit();
}
但是如果我注销并尝试调试它,我会得到一个异常

Ein Ausnahmefehler des Typs“System.Runtime.InteropServices.COMException”位于alphasn0w.exe aufgetreten中

苏斯ätzliche信息:未附

翻译:

alphasn0w.exe中发生“System.Runtime.InteropServices.COMException”类型的异常

附加信息:未附上


如何修复此问题?

这意味着您没有连接到Skype

您将要执行以下操作:

Skype skype = new Skype();
skype.attach(7, true);

“true”表示它将等待用户单击“允许”,然后继续执行代码。

哪一行导致异常?此线程可能会提供一些有关如何调试COM异常的见解。这可以像用户权限问题一样简单,通过以管理员身份运行VS来解决@MikeG代码段的第一行。是否有其他方法来检查用户是否已注销?第1行抛出的异常类型是什么?