Plugin SDK Pascal fixes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6574 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4e380605ea
commit
544711c803
2 changed files with 78 additions and 20 deletions
|
@ -9,12 +9,36 @@
|
|||
Tested in Delphi 7.0
|
||||
}
|
||||
|
||||
// Example NSIS code
|
||||
{
|
||||
Section
|
||||
exdll_with_unit::registerplugincallback
|
||||
|
||||
StrCpy $0 "Hello"
|
||||
Push "World"
|
||||
exdll_with_unit::pop_dlg_push
|
||||
Pop $1
|
||||
DetailPrint $$0=$0
|
||||
DetailPrint $$1=$1
|
||||
|
||||
GetFunctionAddress $0 nsistest
|
||||
Push $0
|
||||
exdll_with_unit::callnsisfunc
|
||||
SectionEnd
|
||||
|
||||
Function nsistest
|
||||
DetailPrint "Hello from NSIS function"
|
||||
FunctionEnd
|
||||
}
|
||||
|
||||
|
||||
library exdll;
|
||||
|
||||
uses
|
||||
nsis, windows;
|
||||
|
||||
procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
|
||||
|
||||
procedure pop_dlg_push(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
|
||||
begin
|
||||
// set up global variables
|
||||
Init(hwndParent, string_size, variables, stacktop);
|
||||
|
@ -25,7 +49,46 @@ begin
|
|||
SetUserVariable(INST_0, 'This is user var $0');
|
||||
end;
|
||||
|
||||
exports ex_dll;
|
||||
|
||||
procedure callnsisfunc(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer); cdecl;
|
||||
var
|
||||
FuncAddr : String;
|
||||
begin
|
||||
Init(hwndParent, string_size, variables, stacktop, extraparameters);
|
||||
|
||||
FuncAddr := PopString();
|
||||
Call(FuncAddr);
|
||||
end;
|
||||
|
||||
|
||||
function mynsiscallback(const NSPIM: TNSPIM): Pointer; cdecl;
|
||||
begin
|
||||
Result := 0;
|
||||
if NSPIM = NSPIM_UNLOAD then
|
||||
begin
|
||||
// Note: Cannot use NSISDialog here because g_hwndParent has been destroyed at this point
|
||||
MessageBox(0, PChar('NSPIM_UNLOAD is the final callback, goodbye...'), PChar('mynsiscallback'), MB_OK);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure registerplugincallback(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer); cdecl;
|
||||
var
|
||||
ThisDllInstance : HMODULE;
|
||||
begin
|
||||
Init(hwndParent, string_size, variables, stacktop, extraparameters);
|
||||
|
||||
if g_extraparameters <> nil then
|
||||
begin
|
||||
ThisDllInstance := hInstance;
|
||||
TRegisterPluginCallback(g_extraparameters.RegisterPluginCallback)(ThisDllInstance, @mynsiscallback);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
exports pop_dlg_push;
|
||||
exports callnsisfunc;
|
||||
exports registerplugincallback;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue