cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
manomatt
Level 8

not able invoke a function in Suite

i am not able invoke a function as defined in this post Calling a Function in a DLL from a Wizard Page or Window in a Suite Installation

http://blogs.flexerasoftware.com/installtalk/2011/12/calling-a-function-in-a-dll-from-a-wizard-page-or-window-in-a-suite-installation.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+InstallTalk+%28Blog%3A+InstallTalk%29


has anyone succeed in this ? Please let me know
Labels (1)
0 Kudos
(6) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

We are currently using this functionality internally on another project's installer and it calls the DLL successfully and the DLL is able to use the suite UI extension interface passed to the DLL.

Can you provide what steps you've taken to implement the DLL and how you added it to a suite project? Note that implementing and using a UI DLL action requires IS 2012 SP1.
0 Kudos
manomatt
Level 8

[list=1]
  • Created a Win32 project in VS 2008
  • updated the project with the code
    "#include "stdafx.h"
    #include
    #import "C:\Program Files\InstallShield\2012\Redist\Language Independent\i386\SetupSuite.exe" no_namespace raw_interfaces_only named_guids


    HRESULT __stdcall Action(IDispatch *pDispSuiteUIExtension)
    {
    CComQIPtr spSuiteUIExtenstion = pDispSuiteUIExtension;

    long lResult = 0;
    return spSuiteUIExtenstion->MessageBox(CComBSTR(L"Hello"), CComBSTR(L"DLL Action"), MB_OK, &lResult);
    }
    "
  • took the build and added the dll to the support files (Language Independent) of a suite project
  • Created a button in the instalWelcome Dialog
  • In the Action contol of the button added the call "{TestSuite::Action}"


    This was the procedure i did but unfortunately i was not able to see anything...help me out from this freakish situation. I am using IS 2012 Premier Edition Sp1
  • 0 Kudos
    MichaelU
    Level 12 Flexeran
    Level 12 Flexeran

    In scenarios like this, it's useful to get a debuglog from setup.exe. If you listed all the steps you did, then I expect you'll see a line that looks like this:
    Could not load custom function from user DLL: &s::TestSuite (oops, that really should be Could not load custom function from user DLL: TestSuite::Action; I'll go fix that).

    If that's the case, you can use a tool like Dependency Walker to show the exported function names in TestSuite.dll, where I expect you'll see a "decorated" name starting with ?Action instead of just Action. If that's the case, you need to export it cleanly. The cheat way is to wrap the function in an extern "C" block, but the clean way is to create a .def file.
    0 Kudos
    manomatt
    Level 8

    what all this you have mentioned i found exactly those wordings in the log file and the decoration ? also.

    i had to change the code to


    extern "C" {
    __declspec(dllexport) HRESULT __stdcall Action(IDispatch *pDispSuiteUIExtension)
    {
    CComQIPtr spSuiteUIExtenstion = pDispSuiteUIExtension;

    long lResult = 0;
    return spSuiteUIExtenstion->MessageBox(CComBSTR(L"Hello"), CComBSTR(L"DLL Action"), MB_OK, &lResult);
    }
    }

    after this i was able to see the "Action" method in dependacy walker. But the issue still exists. In the log file still its saying that Could not load custom function from user DLL: &s::TestSuite

    please guide me...
    0 Kudos
    joshstechnij
    Level 10 Flexeran
    Level 10 Flexeran

    If you are testing this on a machine other than your development machine, ensure that any dependencies needed to load the DLL are present. A better option is to change the DLL to statically link to any dependencies so that they are not needed at runtime on target machines.
    0 Kudos
    manomatt
    Level 8

    hi josh,

    i am testing in my development machine only. There is no dependency for this dll. Can you please provide a sample cpp project (as attachment) so that i can try that out in suite installation and compare with that of mine to see whats is going wrong in mine.

    Thanks in advance
    0 Kudos