2014-02-10 66 views
-4

之前存在的对象是自己的方式来检查应用程序存在之前,我在代码编写创建对象VB检查是否建立

我知道这是安装,我可以使用它,但如果我想程序先检查?

Set objOutlook = GetObject("Outlook.Application") 

回答

0

实际上,您应该验证在注册表中是否有条目。 您可以按照以下步骤操作;

Dim regKey As RegistryKey 

regKey = My.Computer.Registry.ClassesRoot.OpenSubKey("Outlook.Application", False).OpenSubKey("CurVer", False) 

If not string.IsNullOrEmpty(regKey.GetValue("")) then 

// Your code 

End if