How do i......
C#
2
Posts
1
Posters
0
Views
1
Watching
-
Hi, How do I create a COM component in C~ when i know the CLSID of the component, this CLSID is discovered in real-time so i can not add a reference to the DLL at compile time. Cheers
The answer is.... Type comType = Type.GetTypeFromCLSID( new Guid( "12345678-0000-....") ); object comObj = Activator.CreateInstance( comType ); // if you have type infos (tlbimp/reference), try to cast: YourCOMClass yourObj = (YourCOMClass) comObj; // or for some special imported types, wrap: // YourCOMClass yourObj = (YourCOMClass) Marshal.CreateWrapperOfType( comObj, typeof(YourCOMClass) ); To access remote by DCOM: Type dcomType = Type.GetTypeFromCLSID( guid, "REMOTE_PC", false ); ;) :)