Page 1 of 1

Call Dll Function

Posted: Mon Feb 07, 2011 7:36 am
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.

Re: Call Dll Function

Posted: Mon Feb 07, 2011 1:30 pm
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.

Re: Call Dll Function

Posted: Tue Feb 08, 2011 2:37 am
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.

Re: Call Dll Function

Posted: Tue Feb 08, 2011 11:52 am
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

Re: Call Dll Function

Posted: Wed Feb 16, 2011 7:04 am
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.

Re: Call Dll Function

Posted: Wed Feb 16, 2011 7:52 am
by Ghyath

Re: Call Dll Function

Posted: Thu Feb 17, 2011 7:32 am
by giaviv
Dear Ghyath,

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

Re: Call Dll Function

Posted: Tue Jun 14, 2011 11:53 am
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

Re: Call Dll Function

Posted: Wed Jan 25, 2012 1:33 pm
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.

Re: Call Dll Function

Posted: Sun Jan 29, 2012 11:52 pm
by giaviv
Clarification - Call DLL Function works on 32 bit WinAPI style DLLs (including custom DLLs that have stdcall/WinAPI function exports).