2014-12-26 29 views
0

檢查用戶是否註銷時出現異常。檢查用戶是否註銷時出現異常

代碼片段:

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」ist in alphasn0w.exe aufgetreten。

注意:未附上。

翻譯:

類型的異常 'System.Runtime.InteropServices.COMException' 發生在alphasn0w.exe。

附加信息:不附加。

我該如何解決這個問題?

+1

哪一行導致異常? – MikeG

+0

本SO線程可能會提供關於如何調試COM異常的一些見解。這可以像通過以管理員身份運行VS解決的用戶權限問題一樣簡單。 http://stackoverflow.com/questions/4281425/how-to-avoid-a-system-runtime-interopservices-comexception –

+0

發佈附加到異常的堆棧跟蹤,如果有的話。 –

回答

0

這意味着你沒有連接到Skype。

你想做的事:

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

「真」意味着它會等到用戶點擊「允許」,然後繼續你的代碼。

相關問題