Page 1 of 1
retrieving a machine code
Posted: Thu Nov 24, 2005 11:45 am
by HelloWorld
Hi,
I want to retrieve a machine code from an external dll. This dll can be designed anyway i want, so there is no problem, but what is the best way to do this.
With Regards,
Jeroen van Onzen
PS: The double-click in the dialog editor (on a control) is not the most intuitive option. It was driving me crazy to find the option....
PS2: A help file under the Dialog Editor would also be nice.
Posted: Thu Nov 24, 2005 11:57 am
by sinan
Its really up to you! The most complex (and powerful) way would be to build an InstallAware plug-in. This way your DLL has full access to the script variables, can paint its own line in the script, etc...but this is probably overkill for most uses.
The direct way is just to use the Call DLL Function call. It can pass an allocated string buffer (if your ID is textual) or an integer as a variable (if your ID is numeric), among others. So you can make your function prototype in your DLL any way you like and then use the Call DLL Function command to invoke it.
Posted: Fri Nov 25, 2005 9:17 am
by HelloWorld
Hi Support Team,
is it possible to display an integer (which is in a variable) as a hexadecimal code?
Thanks in advance
Posted: Fri Nov 25, 2005 10:34 am
by sinan
Not a built in function, sorry.
Posted: Thu Dec 01, 2005 7:17 am
by HelloWorld
I am trying to call a dll made in delphi with the following function:
Code: Select all
procedure GetMachineCode(out MachineCode: PChar); stdcall;
var sMachineCode: string;
begin
sMachineCode := Format('%x', [100000]);
MachineCode := StrAlloc(9);
StrPCopy(MachineCode, sMachineCode);
end
Any idea why this fails?
Posted: Thu Dec 01, 2005 8:12 am
by sinan
What is the call from the InstallAware side?
Posted: Thu Dec 01, 2005 10:23 am
by HelloWorld
Code: Select all
~InstallAWARE Clipboard Data~
~Call DLL Function~
~{79CC353E-2FF2-4CC8-B8EA-754DE5707248}~
~$SUPPORTDIR$\\dwesetup.dll,GetMachineCode,void,,"pointer to string",$MACHINECODE$,$~
~mIDEFunc.dll\\mEXEFunc.dll~
Posted: Thu Dec 01, 2005 3:38 pm
by sinan
Looks good to me. Are you adding the function name to the exports section at the end of your Delphi DLL code?
Posted: Thu Dec 01, 2005 3:43 pm
by HelloWorld
yes, everything was working well when using a long int as return value in stead of a PChar.
Posted: Thu Dec 01, 2005 3:47 pm
by sinan
I'd say remove the "out" and just say PChar (no var, no out) and try again.