private static Icon GetPOLConfigIcon(ushort ResourceID) { string POLPath = POL.GetApplicationPath("1000"); if (POLPath == null) { return(null); } return(Icons.GetIcon(Path.Combine(POLPath, Path.Combine("polcfg", "polcfg.exe")), ResourceID)); }
private static Icon GetIcon(string FileName, ushort ResourceID) { IntPtr hDLL = Icons.LoadLibrary(FileName); Icon Result = null; if (hDLL != IntPtr.Zero) { IntPtr hIcon = Icons.LoadIcon(hDLL, new IntPtr(ResourceID)); if (hIcon != IntPtr.Zero) { Result = Icon.FromHandle(hIcon); } Icons.FreeLibrary(hDLL); } return(Result); }
private static Icon GetShell32Icon(ushort ResourceID) { return(Icons.GetIcon("shell32.dll", ResourceID)); }
private static IntPtr LoadLibrary(string FileName) { return(Icons.LoadLibraryEx(FileName, IntPtr.Zero, 0x2 /* 0x2 = LOAD_LIBRARY_AS_DATAFILE */)); }