Page 1 of 1

CALL DLL FUNCTION SYNTAX

Posted: Fri Jul 20, 2007 8:53 am
by vincemcc00
Can anyone see whats wrong with this: I keep getting a function not found error:

~InstallAware Clipboard Data~
~Call DLL Function~
~{C8EA685B-9A90-4245-994D-9F2B0BD0011D}~
~"C:\\Users\\myname\\Documents\\Visual Studio 2005\\Projects\\getIPaddress\\getIPaddress\\bin\\Debug\\getIPaddress.dll",test,bool,testVar,$~
~mIDEFunc.dll\\mEXEFunc.dll~


Any help is appreciated.
here's the dll its just a simple c# class to get the ipAddress of a server.

------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace getIPaddress
{
public class ipManager
{
public ipManager()
{
}

public string returnHostName()
{
String strHostName;
strHostName= Dns.GetHostName();
return strHostName;
}

public bool test()
{
return true;
}

public string returnIPAddress()
{
String returnIP;
IPHostEntry ipEntry = Dns.GetHostByName(returnHostName());
IPAddress[] addr = ipEntry.AddressList;


returnIP = addr[0].ToString();


return returnIP;
}
}

}
----------------------------------------------------------------------------------

Posted: Fri Jul 20, 2007 9:20 am
by MichaelNesmith
I don't think you can create C# DLLs which can be called by ordinary Win32 apps using the STDCALL calling convention.

Posted: Fri Jul 20, 2007 9:31 am
by vincemcc00
so do i have to write the dll in c++ so??
Also just wondering can I load a dll into a $PROGRAMFOLDER$ on setup of the installer. Can I just use the INSTALL FILES command in setup. So that I can actually use the CALL DLL FUNCTION to populate a varaiable before the dialog appears.

~Install Files~
~{08E472E5-5D3F-40E7-88CD-1B673C02F140}~
~C:\\Users\\myname\\Documents\\Visual Studio 2005\\Projects\\getIPaddress\\getIPaddress\\bin\\Debug\\getIPaddress.dll~
~FALSE|~
~$PROGRAMFILES$~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~

Regards
Vince

Posted: Fri Jul 20, 2007 9:35 am
by MichaelNesmith
Install Files (and other purple - AKA Windows Installer) commands are not processed until Apply Install. So you may want to add the DLL as a support file and reference it using $SUPPORTDIR$ instead.

You can write a Win32 DLL in any language that supports pure Win32 output, but .NET probably won't work.

Posted: Fri Jul 20, 2007 9:44 am
by vincemcc00
thanks for the reply-im grateful for the nod in the right direction

Posted: Fri Jul 20, 2007 9:46 am
by MichaelNesmith
Also, I just heard that with Delphi .NET you can create DLLs in .NET that can still be called from Win32 applications using a process called reverse P/Invoke.

Posted: Fri Jul 20, 2007 10:19 am
by vincemcc00
thats an idea. Ive used P/Invoke for API fuctions on the windows mobile compact framework which is like a lightweight .net so I could just use it here as well maybe. I dunno anything about Delphi to be honest but i might try P/Invoke in this dll and see what happens