如何从指针或流程/流程名称中获取Window的图标?窗口角落或任务栏或ALT-Tab菜单中显示的图标。
答案 0 :(得分:2)
了解Icon.ExtractAssociatedIcon
:
返回包含在中的图像的图标表示 指定的文件。
private void ExtractAssociatedIconEx()
{
Icon ico =
Icon.ExtractAssociatedIcon(@"C:\WINDOWS\system32\notepad.exe");
this.Icon = ico;
}
http://msdn.microsoft.com/en-us/library/system.drawing.icon.extractassociatedicon.aspx
这不适用于每个流程,但这是一个良好的开端..
还要看一下这些答案 - How can I get the icon from the executable file only having an instance of it's Process in C#
答案 1 :(得分:1)
Icon.ExtractAssociatedIcon会为你效力吗?