newuser
Posts: 3
Joined: Tue Apr 26, 2005 10:05 am

Passing Params to Custom Install DLL

Hi
I am a new user and find tool quite good.
I am using trying to use the tool to install a VB Macro(AddIn) behind an Excel Application(Worksheet).

Firstly I need to Install the AddIn(.xla file) in a user specified location. This can be done by the "Select Installation Folder" screen of the SetUp wizard.

I have 2 problems which are outlined below:

1. I need to know the location of where the client puts the .xla as I need to add it to the Excel Application. I have a dll which attempts to do this - it removes previous AddIns and adds the new AddIn to the Excell Application - hence I need the location of the new AddIn file which the user selected in the aforementioned "Select Installation Folder"

2. I cant seem to get the dll working either. I wrote another FileScripter.dll , to test dll execution from the "Advanced Installer Application" which is nice and simple - it just writes a line of text to a file on the C Drive.
The dll is added as a Custom Action...
Sourcepath = TARGETDIR\FileScripter.dll;
SourceType = dll;
Function Name = WriteToFile;
Execution Properties = Asynchronous execution, wait for return code at the sequence;
Execution Options = Immediate execution;
Execution Condition = NOT INSTALLED
I know that the dll functions correctly as I have written a test exe to run it and it runs successfully.

Any help would be appreciated.

Sean :?:
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi,

1. The "Application Folder" destination is is saved in TARGETDIR property.
Inside a dll you can get a property using the MsiGetProperty() function.

2. There is a correct header for a function that can be launched from MSI:

UINT __stdcall SampleFunction(MSIHANDLE hInstall)

Is your function similar? You can't have any other parameter. All the information that your custom action requires can (only) be obtained using that parameter.


Best,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com
newuser
Posts: 3
Joined: Tue Apr 26, 2005 10:05 am

hi
I am afraid I do not understand how to use the MsiGetProperty(). Would I have to reference some other dll to use this function? I am using Visual Basic - can you provide an example?

Header in Visual Basic? Here is my simple simple code just to test the dll - what else do I need?

Code: Select all

Public Function WriteToFile()

    Dim fnum As Long
    fnum = FreeFile

    Open "C:\AdvancedInstallerTest.txt" For Output As #fnum
    Print #fnum, "sample text"
    Close #fnum

End Function

any help would be great
thanks
:!:
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi,

I can't help you with Visual Basic, but if you are familiar with Visual Basic why don't you use VBScript custom action instead of DLL.
From a VBScript you have access to all the properties using:

Session.Property("SAMPLEPROPERTY").

Regards,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com
newuser
Posts: 3
Joined: Tue Apr 26, 2005 10:05 am

So you are saying to use and ASP file instead of a DLL with the VB Script in the ASP Page? I am not sure how else you would run VB Script?
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi,

No, a VBScript can be run directly from a package installation.
You can find more about Script Custom Actions from:
http://msdn.microsoft.com/library/defau ... cripts.asp

Let me know if you have other questions.

Regards,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”