【发布时间】:2015-01-20 23:35:49
【问题描述】:
如果在此代码中调用LoadVCLStyle_UnInstall 函数时uninstall.vsf 文件不存在,我如何忽略错误消息框?
我认为使用带有空 Except 的 Try 块就足够了,就像在其他语言中一样,但事实并非如此。
// Import the LoadVCLStyle function from VclStylesInno.DLL
procedure LoadVCLStyle_UnInstall(VClStyleFile: String); external 'LoadVCLStyleA@{app}\uninstall.dll stdcall uninstallonly';
//E: Occurs when the uninstaller initializes.
function InitializeUninstall: Boolean;
begin
Result := True;
// Initialize the VCL skin style.
try
LoadVCLStyle_UnInstall(ExpandConstant('{app}\uninstall.vsf'));
except
finally
end;
end;
【问题讨论】:
-
您看到的不是异常,而是引发异常时该插件的消息框
shown by。在这种情况下,您可以通过在尝试加载皮肤之前检查FileExists来解决问题;除了任何其他例外,你都很不走运。 DLL 不得引发任何异常,但在遇到某些问题时不应显示任何对话框,恕我直言。像GetLastError这样的系统会更好。
标签: installation inno-setup pascal uninstallation pascalscript