如何从只具有一个实例的可执行文件获得图标的过程在C# [英] How can I get the icon from the executable file only having an instance of it's Process in C#

查看:137
本文介绍了如何从只具有一个实例的可执行文件获得图标的过程在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从过程获得可执行文件的位置,如何从文件中获取的图标?

也许使用的Windows API LoadIcon()。我不知道是否有.NET的方式...


解决方案

 图标ICO = Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName);

I can get the executable location from the process, how do I get the icon from file?

Maybe use windows api LoadIcon(). I wonder if there is .NET way...

解决方案

Icon ico = Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName);

这篇关于如何从只具有一个实例的可执行文件获得图标的过程在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆