(inno setup)ocx/dll注册代码

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]                                                              
Source: "chysoftPrinter.dll"; DestDir: "{app}"; Flags: ignoreversion regserver;
Source: "chysoftPrinter.dll"; DestDir: "{app}"; Flags: regtypelib;   
Source: "chysoftPrinter.inf"; DestDir: "{app}"; Flags: ignoreversion;  

;拷贝文件到 C:\Windows\system32下
Source: "chysoftPrinter.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace sharedfile; 

;拷贝文件到 C:\Windows\Downloaded Program Files下

Source: "chysoftPrinter.dll"; DestDir: "{win}\Downloaded Program Files"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace sharedfile;
Source: "chysoftPrinter.inf"; DestDir: "{win}\Downloaded Program Files"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace sharedfile;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
;Name: "{group}\ChySoft个人信息管理系统打印控件"; Filename: "{app}\chysoftPrinter.dll"
;Name: "{commondesktop}\ChySoft个人信息管理系统打印控件"; Filename: "{app}\chysoftPrinter.dll"; Tasks: desktopicon

[Run]
Filename: "{app}\chysoftPrinter.inf"; Description: "{cm:LaunchProgram,ChySoft个人信息管理系统打印控件}"; Flags: shellexec postinstall skipifsilent

[code]
//删除所有配置文件以达到干净卸载的目的
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
    if MsgBox('请确认已退出IE,是否同意删除IE中关于本打印控件的相关文件?', mbConfirmation, MB_YESNO) = IDYES then
    //删除 {app} 文件夹及其中所有文件
     DeleteFile(ExpandConstant('{win}\Downloaded Program Files\chysoftPrinter.dll'));
     DeleteFile(ExpandConstant('{win}\Downloaded Program Files\chysoftPrinter.inf'));
end;
[/code]

原文地址:https://www.cnblogs.com/hyruur/p/2594683.html