如何从窗口的指针或进程/进程名称获取窗口的图标?显示在窗口一角、任务栏或 ALT-Tab 菜单中的图标。
最佳答案
了解Icon.ExtractAssociatedIcon
:
Returns an icon representation of an image that is contained in the specified file.
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#
关于c# - 如何在 C# 中获取窗口的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9968648/