This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Calling a dll function
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
07:44 AM
Calling a dll function
URGENT
Hi,
Please suggest with example to call the dll function, in InstallScript, which shall look in C++ as:
prototype:
short myDll.myFunction (short &,integer &,short &,short &);
function call:
short param1=-1,param2=0,param3=0;
int param4 = 0;
nReturn = myFunction(param1, param2, param3, param4); //all parameters are output paramters.
param2 &= 0x00FFFFFF; //after the function call, need to remove the most significant byte.
So how to implement this functionality in Installscript.:confused:
Please help.
Thanks in advance 🙂
Hi,
Please suggest with example to call the dll function, in InstallScript, which shall look in C++ as:
prototype:
short myDll.myFunction (short &,integer &,short &,short &);
function call:
short param1=-1,param2=0,param3=0;
int param4 = 0;
nReturn = myFunction(param1, param2, param3, param4); //all parameters are output paramters.
param2 &= 0x00FFFFFF; //after the function call, need to remove the most significant byte.
So how to implement this functionality in Installscript.:confused:
Please help.
Thanks in advance 🙂
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
09:50 AM
In a quick test, with a C++ DLL whose code is this:
and assuming you've set up a .def file for exports and such, this InstallScript seems to work:
#include
void __stdcall myFunction(short& p1, int& p2, short& p3, short& p4)
{
p1 = 1;
p2 = 2;
p3 = 3;
p4 = 4;
}
prototype void InstallScriptCppDll.myFunction(
BYREF SHORT, BYREF INT, BYREF SHORT, BYREF SHORT);
function OnBegin( )
SHORT s1, s3, s4;
INT s2;
begin
UseDLL(SUPPORTDIR ^ "InstallScriptCppDll.dll");
myFunction(s1, s2, s3, s4);
UnUseDLL("InstallScriptCppDll.dll");
SprintfBox(INFORMATION, "DLL Results",
"s1 = %d, s2 = %d, s3 = %d, s4 = %d",
s1, s2, s3, s4);
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
10:19 AM
Hi,
Thanks Robert. But how to remove the most significant byte? as specified in:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
How to implement this in installscript? Is there any internal function which can be called to convert to Hex, then do the AND & then revert the value back to NUMBER/INT:confused: ?
Please help.
Thanks in advance 🙂
Thanks Robert. But how to remove the most significant byte? as specified in:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
How to implement this in installscript? Is there any internal function which can be called to convert to Hex, then do the AND & then revert the value back to NUMBER/INT:confused: ?
Please help.
Thanks in advance 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
10:52 AM
It shouldn't be necessary to convert between decimal and hex; you can use arithmetic and bit operations (11 + 0xABC is valid, and so on). I don't think there's the &= operator, but please see the help topic "Bit Operators (&, |, ^, ~, <<, >>)".
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
11:14 AM
Hi Robert,
You mean that I can directly call the:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
in installscript as:
p2 = p2 && FFFFFF;?
I suppose this won't work as expected. Well I looked for the Bit operator as well but I think the operands on both sides of the Bit operator should be of the same type i.e. either decimal or hexa:confused: . Please tell me if i'm wrong.
Thanks a lot 🙂
You mean that I can directly call the:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
in installscript as:
p2 = p2 && FFFFFF;?
I suppose this won't work as expected. Well I looked for the Bit operator as well but I think the operands on both sides of the Bit operator should be of the same type i.e. either decimal or hexa:confused: . Please tell me if i'm wrong.
Thanks a lot 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
11:17 AM
There's no hex data type; would p2 = p2 & 0xFFFF; work? (The double ampersand && is the logical-or operator, where single & is the bitwise operator.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
11:19 PM
Thanks a lot Robert. It worked. Thanks a lot again. 🙂