我的Inno Setup
有问题,它给了我异常Operation Unavailable
。
我甚至尝试使用Inno Setup
提供的示例代码CodeAutomation.iss
,但它仍然会给我同样的错误。如何让GetActiveOleObject
工作?我是不是错过了什么?
这是Inno Setup
示例中的代码:
{--- Word ---}
procedure WordButtonOnClick(Sender: TObject);
var
Word: Variant;
begin
if MsgBox('Setup will now check whether Microsoft Word is running. Do you want to continue?', mbInformation, mb_YesNo) = idNo then
Exit;
{ Try to get an active Word COM Automation object }
try
//This is where the error occurs.
Word := GetActiveOleObject('Word.Application');
except
end;
if VarIsEmpty(Word) then
MsgBox('Microsoft Word is not running.', mbInformation, mb_Ok)
else
MsgBox('Microsoft Word is running.', mbInformation, mb_Ok)
end;
提前感谢!
根据以下新闻组帖子:
http://news.jrsoftware.org/news/innosetup/msg71386.html
http://news.jrsoftware.org/news/innosetup/msg71387.html
这是经过设计的,只有在IDE中运行时才会发生。运行已编译的安装程序时是否出现错误?我刚刚在Win7 SP1 x64计算机上尝试了CodeAutomation.iss中的代码,它运行正常。