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 –