CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

CreateComInstance - Late Binding COM instantiation

373 Views
Copy Code Show/Hide Line Numbers
 
/// <summary>
/// Creates a COM instance from a ProgID. Loads either
/// Exe or DLL servers.
/// </summary>
/// <param name="progId"></param>
/// <returns></returns>
public static object CreateComInstance(string progId)
{
    Type type = Type.GetTypeFromProgID(progId);
    if (type == null)
        return null;
 
    return Activator.CreateInstance(type);
}
 
by Rick Strahl
  January 29, 2010 @ 2:52pm
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate