Using COM object in C#
I'm trying to use TrustCommerce in my website. I installed dll files from the website, but I can't use it' I'm supposed to be able to use myObject.PushParam(string)
and it's not working. Is there something I'm missing here? I found an article about it in PHP:
public static void TrustCommerce()
{
//TCLinkNET.TClinkClass.
object myObject = Orders.COMCreateObject("TCLINKCOMLib.TClinkClass");
}
publ开发者_StackOverflow社区ic static object COMCreateObject(string sProgID)
{
// We get the type using just the ProgID
Type oType = Type.GetTypeFromProgID(sProgID);
if (oType != null)
{
return Activator.CreateInstance(oType);
}
return null;
}
add COM reference to your project, then an introp assembly will be generated for the COM. the way you are using requires reflection to invoke COM methods. 3.5 or less, do not forget to distribute the interop assembly with your application installer.
精彩评论