Call Dll Function

Got a problem you cannot solve? Try here.
Post Reply
Ghyath
Posts: 10
Joined: Tue Jan 18, 2011 3:27 am

Call Dll Function

Post by Ghyath »

Kindly, i need a sample of how to use the Call Dll Function in InstallAware.
I need to develop a new dll using C# code.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Call Dll Function

Post by giaviv »

Dear Ghyath,

To call a DLL function, simply drag (or start typing) the Call DLL Function command in the MSIcode tab in your InstallAware IDE. Enter the path to your dll in the "DLL Path" field (for example - %TARGETDIR%\mydll.dll). Enter your function's name in the "Function Name" field and that should do it - let me know if you have further questions.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Ghyath
Posts: 10
Joined: Tue Jan 18, 2011 3:27 am

Re: Call Dll Function

Post by Ghyath »

Thanks for you reply,

I already did what you said, but i am still getting this error FUNCTIONNOTFOUND.
This means that the dll is loaded but the function could not be found.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Call Dll Function

Post by giaviv »

Dear Ghyath,

Are you sure you exported your functions properly? Are you sure that your compiler doesn't decorate the functions' headers?
Try running cmd.exe and typing rundll32 DLL, FUNC
where DLL is the full path to your DLL and FUNC is your function's name.
For example: rundll32 c:\windows\system32\user32.dll, MessageBoxA
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Ghyath
Posts: 10
Joined: Tue Jan 18, 2011 3:27 am

Re: Call Dll Function

Post by Ghyath »

Thank you for your reply.
I tried the above, an error occurred after running the rundll32 which is Missing entry: MethodName.

do you have any idea how to solve it.
note that I am using C# class library project.
Ghyath
Posts: 10
Joined: Tue Jan 18, 2011 3:27 am

Re: Call Dll Function

Post by Ghyath »

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Call Dll Function

Post by giaviv »

Dear Ghyath,

Thanks, but note that your problem had to do with how you build your DLL and not with InstallAware.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
m.duchesneau
Posts: 21
Joined: Tue May 24, 2011 1:42 pm

Re: Call Dll Function

Post by m.duchesneau »

Thanks for the link Ghyath, it proved very useful to me, as I wanted to create a DLL using VS2010 and the .NET Framework4; it works like a charm.

cheers!
Mat
isatterfield
Posts: 2
Joined: Tue Jan 10, 2012 1:56 pm

Re: Call Dll Function

Post by isatterfield »

I can't get this to work. I used the Test example, it compiles clean in Visual Studio 2010 using .NET Framework 3.5 and Robert's template project. I'm trying to build his Test class example.
I still get FUNCTIONNOTFOUND from InstallAware. And when I use RunDLL32, it says I'm missing the entry point for Add.
I added <Import Project="$(MSBuildProjectDirectory)\DllExport\RGiesecke.DllExport.targets" /> and have his DLLExport class. It compiles clean, but still can't find the function. Any insight would be greatly appreciated.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Call Dll Function

Post by giaviv »

Clarification - Call DLL Function works on 32 bit WinAPI style DLLs (including custom DLLs that have stdcall/WinAPI function exports).
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply