protected override void CleanUp() { if (pAppAssocReg != null) { Marshal.FinalReleaseComObject(pAppAssocReg); pAppAssocReg = null; } base.CleanUp(); }
private FileAssociatorW6(string docTypePrefix, string appName) : base(docTypePrefix, appName) { object comobj = null; try { Type type = Type.GetTypeFromCLSID(Shell.CLSID_ApplicationAssociationRegistration, true); comobj = Activator.CreateInstance(type); pAppAssocReg = (Shell.IApplicationAssociationRegistration)comobj; } catch { if (comobj != null) { Marshal.FinalReleaseComObject(comobj); } } }