steven

steven

  • NA
  • 24
  • 41.8k

Can i directly use PInvoke DllImport attribute to call a function from a COM DLL?

Sep 16 2011 5:16 AM
it is a COM dll, so i can call the function in javascript like this:

         var typelib = new ActiveXObject("scriptlet.typelib");
        typelib.Reset();
        document.getElementById("myID").innerHTML = typelib.guid;

It works well.


But i tried to call a function from the COM, it did not work.


[DllImport("scrobj.dll")]
internal static extern void Reset();

...
...

Reset();


It said Unable to find an entry point named 'Reset' in DLL 'scrobj.dll'.


1) Can i directly use PInvoke DllImport attribute to call a function from a COM DLL?
2) WHY?

Thanks.




Answers (6)