PDA

View Full Version : Use DLL to add a local user group



ottoyu
05-26-2004, 08:52 AM
Hi:

We have created a standard Windows DLL with a method called addGroup. I am trying to use the Custom Action to call that method in that DLL. But I tried it several different way and still can't get it work. Usually I got an error message said "Can't find the DLL file." Then I included that DLL into my ProgramFileFolder so it will get copy to the target system. The last one I tried still getting "Internal Error 2762" during Removing Backup files.

Can anyone show me what should be the right way to use a DLL in the Custom Action? I am new to InstallShield. Please be detail if possible.

Thank you for the help.


Regards,
Otto

MichaelU
05-26-2004, 10:23 AM
Hello Otto,

Have you seen this help document (http://helpnet.installshield.com/Robo/BIN/Robo.dll?tpc=/robo/projects/installshieldxhelplib/IHelpInsertCARulesDLL.htm) which discusses various places you can include your DLL, and what restrictions on sequencing the custom action are imposed by each of those places?

Michael

ottoyu
05-26-2004, 11:44 AM
Michael:

Thanks for your help and pointing to the right document. I followed the way on the document: Installed DLL, Immediate Execution Scheduling and After InstallFinalize Sequence. But I got the error message " File <path of the dll> can not be found. Make sure the file is on target system or installed already." I checked the drive on the target system and saw the dll file is in that folder.
Do you know why I am getting that error?

Again, thank you for your help.


Regards,
Otto

MichaelU
05-26-2004, 06:01 PM
Otto,
So while the error message is on the screen you can go to that exact path and see the file present? What kind of custom action do you have? Perhaps attach a screenshot.

Michael

ottoyu
05-27-2004, 08:01 AM
Michael:

Yes, while I got the error, I checked the Explorer and saw the DLL file has been moved by InstallShield into the right directory.
I used New Standard Dll with Installed with Product. Here is the screen shot of the Custom Action.
Thanks for your help.


Regards,
Otto

MichaelU
05-27-2004, 09:04 AM
Otto,
I was only able to replicate this message if I specifically made sure the file was not installed by deselecting its feature. Otherwise the message I got was: Can not find the entry point of function 'MyFunction', make sure it is exported.

However, unlike your case, when I get your error message the DLL is not present. When I get my error message it's there. Shooting in the dark here, do you possibly have multiple sources of the same DLL? Does it work any better if you switch to a deferred action set "Before InstallFinalize and After InstallFiles"?

As an aside, unless you want to try to run this action at uninstall after the DLL has been removed, I would suggest adding the condition: Not Installed.

Michael

ottoyu
05-27-2004, 09:58 AM
Michael:

I have my Dll file with my other application files in the ProgramFilesFolder. So during the installation, InstallShield moved all the files in ProgramFilesFolder to c:\Program Files right. That's how I saw my Dll file in that directory. I still not understanding why the Custom Action can't find the file. But it seems able to find your dll. I have also tried deferred action set "After InstallFiles", I can't set "Before InstallFinalize and After InstallFiles". The result were the same message.

You would suggest adding the condition: Not Installed. I am not sure what is that mean and how to do that? Can you be a little specific?


Regards,
Otto

ottoyu
05-28-2004, 10:00 AM
Michael:

Thanks a lot for all your help. Now I got the error message you mention "Can not find the entry point of 'addGroup'. Make sure it is exported."

addGroup is a method in my dll. But what does it mean by 'make sure it is exported'? Do I need to export it in certain way?


Regards,
Otto

MichaelU
05-28-2004, 03:09 PM
Hello Otto,
In the view you have pictured in your screenshot, there is a value of After InstallFinalize for the Install Execute sequence, but there is currently no value for Install Execute Condition. For that entry, I would suggest putting in the value "Not Installed"

Regarding "exported", this is a matter of making sure your function is visible to external users of this DLL by being present in the DLL's export table. Try a search here on the forums for further information, such as that in http://community.installshield.com/showthread.php?s=&threadid=131702