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: Need help for DLL custom action
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
‎Nov 16, 2009
01:02 AM
Need help for DLL custom action
Hi Guys,
I am new to installshield and need your help. We have created our project in Basic MSI and now we would like to convert our project to pure installscript. I know if we convert our project from Msi to Installscript we will miss our custom action and we should use installscript code to achieve this. We have created our DLL by using the Vc++ (by use of visual studio). Now I would like to use this DLL in my Installscript project... Can you please let me know the way with sample example to do this.
how to call the functions that used in the DLL and how to return the DLL function results.
Thanks for your help
Regards
Sweetie
I am new to installshield and need your help. We have created our project in Basic MSI and now we would like to convert our project to pure installscript. I know if we convert our project from Msi to Installscript we will miss our custom action and we should use installscript code to achieve this. We have created our DLL by using the Vc++ (by use of visual studio). Now I would like to use this DLL in my Installscript project... Can you please let me know the way with sample example to do this.
how to call the functions that used in the DLL and how to return the DLL function results.
Thanks for your help
Regards
Sweetie
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
01:30 AM
What package you are creating either full inatallation or patch?
Which installashield version you are using?
thanks
madhu.
Which installashield version you are using?
thanks
madhu.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
01:31 AM
Copy your VC++ dll to SupportFIles/Billboards ->SupportFiles ->Language Independent. It will copy your file to the tempfolder during installation.
Then you can use this dll to diiferent functions of installscript. But first you need to load this dll before using it. Also you need to unload it after using.
e.g.
function load()
STRING dllPath;
begin
dllPath = SUPPORTDIR ^ "Test.dll";
if ( 0 != UseDLL(dllPath) ) then
MessageBox("Failed to load dependency file", SEVERE);
abort;
endif;
end;
Let me know if need any more help.
Then you can use this dll to diiferent functions of installscript. But first you need to load this dll before using it. Also you need to unload it after using.
e.g.
function load()
STRING dllPath;
begin
dllPath = SUPPORTDIR ^ "Test.dll";
if ( 0 != UseDLL(dllPath) ) then
MessageBox("Failed to load dependency file", SEVERE);
abort;
endif;
end;
Let me know if need any more help.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
01:40 AM
After copying dll in to components you can use the following function to check the dll exists and then you can use the dll..
Here i have taken ldf_jpm_dotNET.dll as an example..
function DllInfo()
NUMBER nResult;
begin
nResult = Is(FILE_EXISTS, INSTALLDIR^ "ldf_jpm_dotNET.dll");
if nResult = TRUE then
// SprintfBox (INFORMATION, "DELETE DLL", "%s is Present .", INSTALLDIR^ "ldf_jpm_dotNET.dll");
// Delete the file specified by DEL_FILE from the target directory.
End;
thanks
madhu
Here i have taken ldf_jpm_dotNET.dll as an example..
function DllInfo()
NUMBER nResult;
begin
nResult = Is(FILE_EXISTS, INSTALLDIR^ "ldf_jpm_dotNET.dll");
if nResult = TRUE then
// SprintfBox (INFORMATION, "DELETE DLL", "%s is Present .", INSTALLDIR^ "ldf_jpm_dotNET.dll");
// Delete the file specified by DEL_FILE from the target directory.
End;
thanks
madhu
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
01:45 AM
Thank you for your reply.
Yes, I know how to load and unload the DLL. My problem is we are using the DLL custom action in Basic MSi and calling the function in the variouse sequence for example,
DLL Filename - aaaInstall.dll
Function name- CheckXPSystem
In-script Execution- Immediate Execution
Execution Scheduling -Always Execute
Install UI sequence - After launchCondition
and some other function in After InstallFinalize, After PublishProduct
now, where I have to call this function in Pure installscript events and how to call the function?
I am creating Full Installation with Installshield 2010.
Thanks
Yes, I know how to load and unload the DLL. My problem is we are using the DLL custom action in Basic MSi and calling the function in the variouse sequence for example,
DLL Filename - aaaInstall.dll
Function name- CheckXPSystem
In-script Execution- Immediate Execution
Execution Scheduling -Always Execute
Install UI sequence - After launchCondition
and some other function in After InstallFinalize, After PublishProduct
now, where I have to call this function in Pure installscript events and how to call the function?
I am creating Full Installation with Installshield 2010.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
02:51 AM
Please help me with this, it's very urgent. Thanks
Sweetie wrote:
Thank you for your reply.
Yes, I know how to load and unload the DLL. My problem is we are using the DLL custom action in Basic MSi and calling the function in the variouse sequence for example,
DLL Filename - aaaInstall.dll
Function name- CheckXPSystem
In-script Execution- Immediate Execution
Execution Scheduling -Always Execute
Install UI sequence - After launchCondition
and some other function in After InstallFinalize, After PublishProduct
now, where I have to call this function in Pure installscript events and how to call the function?
I am creating Full Installation with Installshield 2010.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
03:28 AM
sweetie,
check the following link it may help you.........
http://community.installshield.com/showthread.php?t=137881&highlight=call+dll+function
if it is not helpful let me know......
thanks
madhu
check the following link it may help you.........
http://community.installshield.com/showthread.php?t=137881&highlight=call+dll+function
if it is not helpful let me know......
thanks
madhu
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
03:39 AM
I am attaching you a piece of code which is working for me. This piece of code gets executed during uninstall of the product. Actually installscript does not have the FOREACH function, and only due to that i need to use the C++ dll to remove the websites/Virtual directories from the IIS which are linked to a particular physical folder only. You can call these functions in your custom actions also.
Choose the option "Run the installscript code" in the custom action wizard, and then select the function name. The function name will apppear here only if the function prototype is defined with the export keyword.
export prototype Foo();
Hope this will help you.
Choose the option "Run the installscript code" in the custom action wizard, and then select the function name. The function name will apppear here only if the function prototype is defined with the export keyword.
export prototype Foo();
Hope this will help you.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 16, 2009
04:28 AM
ChandanOmkar is right. create an object using CoGetObject function, then u can call its method. the example from installshield manual is attached.
CoGetObject Example
InstallShield 2010 » InstallScript Language Reference
/*-----------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the CoGetObject function.
*
* This example shows how to create a virtual
* directory on IIS server.
*
\*-----------------------------------------------------------*/
#include "ifx.h"
#define VIRTUALDIR "My Virtual Dir"
#define VIRTUALDIRPATH "c:\inetpub\wwwroot\MyDir"
function OnBegin()
OBJECT objIIS_Root, objVirtDir;
begin
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
if (IsObject(objIIS_Root)) then
try
set objVirtDir = objIIS_Root.Create("IISWebVirtualDir", VIRTUALDIR);
if (IsObject(objVirtDir)) then
objVirtDir.Path = VIRTUALDIRPATH;
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;
objVirtDir.SetInfo();
objVirtDir.AppCreate(TRUE);
objVirtDir.SetInfo();
endif;
catch
MessageBox("Unable to create Virual Directory.", INFORMATION);
endcatch;
endif;
end;
CoGetObject Example
InstallShield 2010 » InstallScript Language Reference
/*-----------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the CoGetObject function.
*
* This example shows how to create a virtual
* directory on IIS server.
*
\*-----------------------------------------------------------*/
#include "ifx.h"
#define VIRTUALDIR "My Virtual Dir"
#define VIRTUALDIRPATH "c:\inetpub\wwwroot\MyDir"
function OnBegin()
OBJECT objIIS_Root, objVirtDir;
begin
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
if (IsObject(objIIS_Root)) then
try
set objVirtDir = objIIS_Root.Create("IISWebVirtualDir", VIRTUALDIR);
if (IsObject(objVirtDir)) then
objVirtDir.Path = VIRTUALDIRPATH;
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;
objVirtDir.SetInfo();
objVirtDir.AppCreate(TRUE);
objVirtDir.SetInfo();
endif;
catch
MessageBox("Unable to create Virual Directory.", INFORMATION);
endcatch;
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2014
06:22 AM
ChandanOmkar wrote:
Copy your VC++ dll to SupportFIles/Billboards ->SupportFiles ->Language Independent. It will copy your file to the tempfolder during installation.
Then you can use this dll to diiferent functions of installscript. But first you need to load this dll before using it. Also you need to unload it after using.
e.g.
function load()
STRING dllPath;
begin
dllPath = SUPPORTDIR ^ "Test.dll";
if ( 0 != UseDLL(dllPath) ) then
MessageBox("Failed to load dependency file", SEVERE);
abort;
endif;
end;
Let me know if need any more help.
Hi Sir,
I need to call a function of my loaded dll. And I am trying to do it but I am getting an error (2147219709). please help me on this. I am posting my code below
prototype stdcall INT SocialSafeDll.Add(INT,INT);
export prototype ExFn_UseDLL(HWND);
function ExFn_UseDLL(hMSI)
NUMBER nResult;
STRING supportDirPath, szPath;
NUMBER nLength;
INT returnValue;
begin
nLength = 256;
// Returns path to the Support files path extracted on the target machine.
MsiGetProperty(hMSI, "SUPPORTDIR", supportDirPath,nLength);
szPath = supportDirPath ^ "SocialSafeDll.dll";
// Load the .dll file into memory.
nResult = UseDLL(szPath);
if (nResult = 0) then
MessageBox ("UseDLL successful \n\n.dll file loaded.", INFORMATION);
else
MessageBox ("UseDLL failed.\n\nCouldn't load .dll file.", INFORMATION);
abort;
endif;
try
MessageBox ("before loading in try block", INFORMATION);
returnValue = SocialSafeDll.Add(2,3);
MessageBox ("after loading in try block", INFORMATION);
catch
MessageBox ("in catch block" + Err, INFORMATION);
endcatch;
SprintfBox (INFORMATION, "UseDLL", "MydllReturn() changed the string " +"to: %d", returnValue);
// Remove the .dll file from memory.
if (UnUseDLL (szPath) < 0) then
MessageBox ("UnUseDLL failed.\n\n.dll file still in memory.", SEVERE);
else
MessageBox ("UnUseDLL successful.\n\n.dll file removed from memory.",
INFORMATION);
endif;
end;
