Beispiel #1
0
        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));
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 private static Icon GetShell32Icon(ushort ResourceID)
 {
     return(Icons.GetIcon("shell32.dll", ResourceID));
 }
Beispiel #4
0
 private static IntPtr LoadLibrary(string FileName)
 {
     return(Icons.LoadLibraryEx(FileName, IntPtr.Zero, 0x2 /* 0x2 = LOAD_LIBRARY_AS_DATAFILE */));
 }