DLL库函数名称区分大小写,并且您使用别名代替InnoSetup脚本中的函数名称。修改您的脚本,以便使用具有适当区分大小写的函数名称,并让您的脚本正常工作。要导入的函数的名称是来自external
关键字导入尾部的@
char之前的单词。例如,下面的函数导入样品中,导入函数的名称是newwebwnd
,不NewWebWnd
:
function NewWebWnd(hWndParent: HWND; X, Y, nWidth, nHeight: Integer): HWND;
external '[email protected]:webctrl.dll stdcall';
所以你的情况,修改函数名称下面的方式,你应该罚款:
然后
...
System::Call "webctrl::newwebwnd(i $hCtl_dialog, i 0, i 0, i 150, i 150) i.s"
Pop $browser
System::Call "webctrl::displayhtmlpage(i $browser, t 'http://www.google.com/') b.s"
Pop $R0
...
的安装页面内拉伸WebCtrl
控制整个脚本可能是这样的:
!include "nsDialogs.nsh"
OutFile "Setup.exe"
RequestExecutionLevel user
InstallDir $DESKTOP\WebBrowserSetup
Page directory
Page custom InitializeWebBrowserPage
var hDialog
var hBrowser
Function InitializeWebBrowserPage
InitPluginsDir
SetOutPath $PLUGINSDIR
File "webctrl.dll"
nsDialogs::Create 1018
Pop $hDialog
; get the page client width and height
System::Call "*(i, i, i, i) i.r0"
System::Call "user32::GetClientRect(i $hDialog, i r0)"
System::Call "*$0(i, i, i.r1, i.r2)"
System::Free $0
; create a web browser window stretched to the whole page client rectangle
; and navigate somehwere; note that you should add some error handling yet
System::Call "webctrl::newwebwnd(i $hDialog, i 0, i 0, i $1, i $2) i.s"
Pop $hBrowser
System::Call "webctrl::displayhtmlpage(i $hBrowser, t 'http://www.google.com') b.s"
Pop $R0
nsDialogs::Show
FunctionEnd
Section ""
SectionEnd
只是一个几个笔记,因为我不知道NSIS。 1)['WebCtrl'](http://restools.hanzify.org/inno/webctrl/inno_webctrl_v2.1.zip)是ANSI库(非Unicode),因为它显然在['import']中显示(对于使用'PChar'的InnoSetup,InnoSetup的ANSI版本中的ANSI字符的指针是什么。 2)你确定你想通过'$ HWNDPARENT'作为网页控制的父母吗?这不应该是'$ hCtl_dialog'吗? 3)最后,检查函数的返回值。 – TLama
1)没关系,我是unis ANSI版本的NSIS。 2)我先尝试了'$ hCtl_dialog',但没有成功。使用$ HWNDPARENT是一个反复试验。 3)我会做的,谢谢! :-D –