Salut J'ai une DLL COM implémentée dans ATL et maintenant je veux développer un test exe en C# pour tester les fonctionnalités. Comment appeler une DLL COM à partir d'une application C#?Comment puis-je appeler une DLL COM à partir de l'application C#?
J'ai testé avec LoadLibrary() mais AFAIK c'est pour la DLL native de Win32. Aussi, je ne suis pas sûr que CoCreateInstance est appelé quelque part dans LoadLibrary()?
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
static extern IntPtr LoadLibrary(string lpFileName);
private int LoadDLL()
{
dllPath = lblDllPath.Text;
int i_hmod = 0;
IntPtr hMod = LoadLibrary(dllPath);
i_hmod = hMod.ToInt32();
if (i_hmod > 0)
{
txtOutput.Text += "Dll successfully loaded\r\n";
}
else
{
txtOutput.Text += "LoadLibrary failed\r\n";
}
return i_hmod;
}
Thnx