6
Answers

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

steven

steven

13y
4.6k
1
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)