public void Dispose() { if (_enumHandler != null && Marshal.IsComObject(_enumHandler)) { Marshal.ReleaseComObject(_enumHandler); } _enumHandler = null; }
public static IAssocHandler[] EnumFileHandlers(string fileExtension, bool flush = false) { var assoc = flush ? null : FindInCache(fileExtension); if (assoc is object) { return(assoc); } if (lAssoc.Count > 0) { lAssoc.Clear(); } IAssocHandler h = null; IEnumAssocHandlers handlers = null; uint cret; try { NativeShell.SHAssocEnumHandlers(fileExtension, ASSOC_FILTER.RECOMMENDED, out handlers); } catch { return(null); } do { handlers.Next(1U, out h, out cret); if (h is object) { lAssoc.Add(h); } }while (cret > 0L); assoc = lAssoc.ToArray(); AddToCache(fileExtension, assoc); return(assoc); }
public static extern long SHAssocEnumHandlers([In, MarshalAs(UnmanagedType.LPWStr)] string pszExtra, [In] ASSOC_FILTER afFilter, [Out, MarshalAs(UnmanagedType.Interface)] out IEnumAssocHandlers ppEnumHandler);
public static extern HResult SHAssocEnumHandlers([MarshalAs(UnmanagedType.LPWStr)][In] string pszExtra, [In] ASSOC_FILTER afFilter, out IEnumAssocHandlers ppEnumHandler);
internal static extern Int32 SHAssocEnumHandlersForProtocolByApplication( [In, MarshalAs(UnmanagedType.LPWStr)] string protocol, ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IEnumAssocHandlers ppEnumHandler);