Creating an instance of an unmanaged COM object with the CLSID

jd6strings

New member
Joined
Jul 28, 2004
Messages
3
Hello All-

Can anyone provide a syntax example for creating an instance of an unmanaged COM object WITHOUT using a reference AND only using the CLSID or the progID??

Thx!!!
 
jd6strings said:
Hello All-

Can anyone provide a syntax example for creating an instance of an unmanaged COM object WITHOUT using a reference AND only using the CLSID or the progID??

Thx!!!
I could be wrong here, but I think you have to create an interop references of some kind. Here is why:

lets say I have a COM object, MyCOM, that has a method DoSomething.

if I could instance it via something along the lines of

object myCom = Unmanaged.CreateObject(CLSID_MyCOM);

the run time has no way of knowing what the interface of myCom looks like therefore "myCom.DoSomething();" wont compile.

I ran into a problem with the TaskScheduler library where I couldnt interop the mstask.dll (will someone please explain what it is about dlls like mstask that prevents interop!)

After doing some hunting on the net I found the attached interop wrapper.
If you dont want to add an iterop reference, you will have to create something like this. So if possible, attach the reference, because this looks like a pain in the a** to do by hand
 

Attachments

Back
Top