1
下面是一些示例代碼:在這個Outlook 2007應用程序中,Explorers.NewExplorer事件怎麼沒有被觸發?
private Outlook.Application applicationObject;
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
MessageBox.Show("on connection");
applicationObject = (Outlook.Application)application;
applicationObject.Explorers.NewExplorer += new Microsoft.Office.Interop.Outlook.ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer);
}
void Explorers_NewExplorer(Microsoft.Office.Interop.Outlook.Explorer Explorer)
{
MessageBox.Show("new explorer");
}
「新資源管理器」的消息從來沒有出現在屏幕上,因爲NewExplorer事件永遠不會觸發,即使是在我點擊「在新窗口打開」。
什麼可能是錯的?
我不會猜到它。感謝您的幫助:) –
沒問題:-)把它作爲一個通用規則:無論您何時訂閱COM對象的事件,都需要保持該對象活着。 – Douglas