Microsoft Office icons are copyrighted by Microsoft and this prevents us from using them in non-Microsoft applications due to their licence terms.
I\'m trying to find so
I'm guessing you mean file icons, not the applications. As long as office is installed you can use code to load the icons at runtime e.g. GetFileIcon("doc", SHGFI_ICONSIZE_LARGE)
const uint SHGFI_ICON = 0x100;
const uint SHGFI_USEFILEATTRIBUTES = 0x10; // Use file extension not name
const uint SHGFI_ICONSIZE_SMALL = 1;
const uint SHGFI_ICONSIZE_LARGE = 0;
const uint FILE_ATTRIBUTE_NORMAL = 0;
const uint FILE_ATTRIBUTE_DIRECTORY = 16;
[StructLayout(LayoutKind.Sequential)]
struct SHFILEINFO
{
public IntPtr hIcon;
public IntPtr iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
}
[DllImport("shell32.dll")]
private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
static System.Drawing.Icon GetFileIcon(string extension, uint size)
{
IntPtr hImgResult; //the handle to the system image list
SHFILEINFO shinfo = new SHFILEINFO();
if (string.Compare(extension,"folder",true)==0)
{
hImgResult = SHGetFileInfo("", FILE_ATTRIBUTE_DIRECTORY, ref shinfo,
(uint)Marshal.SizeOf(shinfo),
SHGFI_ICON | size);
}
else
{
hImgResult = SHGetFileInfo(extension, FILE_ATTRIBUTE_NORMAL, ref shinfo,
(uint)Marshal.SizeOf(shinfo),
SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | size);
}
return System.Drawing.Icon.FromHandle(shinfo.hIcon);
}