首页 > 解决方案 > 在 Inno Setup 窗口中打开外部程序

问题描述

我有一些 Exe 格式的动画,我需要将它们加载到 Inno Setup 的面板中。

我找到了关于 Delphi 的这些:http:
//www.delphipages.com/forum/archive/index.php/t-200729.html
如何外壳到另一个应用程序并让它以 delphi 形式出现

如何在 Inno Setup 中实现这样的事情?

标签: inno-setup

解决方案


Inno Setup 的等效代码如下:

[Code]

function SetParent(hWndChild: HWND; hWndNewParent: HWND): HWND;
  external 'SetParent@User32.dll stdcall';
function ShowWindow(hWnd: HWND; nCmdShow: Integer): BOOL;
  external 'ShowWindow@User32.dll stdcall';

procedure InitializeWizard();
var
  Page: TWizardPage;
  ResultCode: Integer;
  ProgHandle: HWND;
begin
  Page := CreateCustomPage(wpWelcome, 'Test', '');

  Exec('notepad.exe', '', '', SW_HIDE, ewNoWait, ResultCode);

  while ProgHandle = 0 do
    ProgHandle := FindWindowByWindowName('Untitled - Notepad');

  SetParent(ProgHandle, Page.Surface.Handle);
  ShowWindow(ProgHandle, SW_SHOWMAXIMIZED);
end;

在此处输入图像描述


虽然我建议你不要这样做。这是一个不可靠的黑客。在安装程序本身中通过 Pascal 代码显示图像。


推荐阅读