CLSIDFromProgID (ole32)
Last changed: -24.248.164.2

.
Summary

C# Signature:

[DllImport("ole32.dll", CharSet=CharSet.Unicode, ExactSpelling=true, PreserveSig=false)]
static extern Guid CLSIDFromProgID(string lpszProgID);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Alternative declaration is used!

[DllImport("ole32.dll", CharSet=CharSet.Unicode]
static extern  ulong CLSIDFromProgID(string lpszProgID, ref Guid uuid);

Example

public class MyForm : System.Windows.Forms.Form
{
   ...    
   public Control AddLegacyControlAtRuntime(string ProgId)
   {
    Guid clsid = new Guid();
    CLSIDFromProgID(ProgId, ref clsid);

    _legacyControlAxHost = new LegacyControlAxHost(clsid.ToString());
    this.Controls.Add(_legacyControlAxHost);
    return _legacyControlAxHost;
   }
   ...
}

(LegacyControlAxHost is custom class inherited From AxHost)

Alternative Managed API:

Do you know one? Please contribute it!

Documentation