VB.Net或C#获取程序图标

Kation 2010-08-25 09:11:39
RT
获取EXE图标
...全文
205 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
mojieke 2010-08-31
  • 打赏
  • 举报
回复
顶一下,3楼
ginpq 2010-08-29
  • 打赏
  • 举报
回复
标记呀。
beyondma 2010-08-28
  • 打赏
  • 举报
回复
[DllImport("Shell32.dll")]
public static extern IntPtr SHGetFileInfo(string pszPath,
uint dwFileAttributes, ref SHFILEINFO psfi,
int cbfileInfo, uint uFlags);
你看一下这几个参数都是干嘛的MSDN一下就成啊。
兔子-顾问 2010-08-27
  • 打赏
  • 举报
回复
给你写例子了
VB.Net mobile下获得文件图标
http://download.csdn.net/source/2652492
Kation 2010-08-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 wuyazhe 的回复:]
1楼就有正确答案了。
[/Quote]
可是我不知道怎么用……
兔子-顾问 2010-08-27
  • 打赏
  • 举报
回复
1楼就有正确答案了。
Kation 2010-08-27
  • 打赏
  • 举报
回复
囧,麻烦各位大大解释一下啊……
mojieke 2010-08-26
  • 打赏
  • 举报
回复
顶,我也在找这方面代码
Kation 2010-08-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 jiangyongtao 的回复:]
C# code

[DllImport("Shell32.dll")]
public static extern IntPtr SHGetFileInfo(string pszPath,
uint dwFileAttributes, ref SHFILEINFO psfi,
int cbfileInfo, uint uFlags);

public struct S……
[/Quote]
[Quote=引用 3 楼 rrrfff 的回复:]
C# code

public struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
public string szDisplayName;
public string szTypeName;
}
namespa……
[/Quote]
囧啊,还是不懂怎么用,能不能写个例子
获取成Drawing.Icon&……
Kation 2010-08-25
  • 打赏
  • 举报
回复
翻译机:
<DllImport("Shell32.dll")> _
Public Shared Function SHGetFileInfo(pszPath As String, dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, cbfileInfo As Integer, uFlags As UInteger) As IntPtr
End Function

Public Structure SHFILEINFO
Public hIcon As IntPtr
Public iIcon As Integer
Public dwAttributes As Integer
Public szDisplayName As String
Public szTypeName As String
End Structure

怎么用……
世外涛缘 2010-08-25
  • 打赏
  • 举报
回复

[DllImport("Shell32.dll")]
public static extern IntPtr SHGetFileInfo(string pszPath,
uint dwFileAttributes, ref SHFILEINFO psfi,
int cbfileInfo, uint uFlags);

public struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public int dwAttributes;
public string szDisplayName;
public string szTypeName;
}
SongQues 2010-08-25
  • 打赏
  • 举报
回复
基本就这几个函数!
RLib 2010-08-25
  • 打赏
  • 举报
回复

public struct SHFILEINFO
{
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
public string szDisplayName;
public string szTypeName;
}
namespace TEST
{
static class Program
{
static uint SHGFI_ICON = 0x000000100; // get icon,must be
static uint SHGFI_LARGEICON = 0x000000000; // get large icon
static uint SHGFI_SMALLICON = 0x000000001; // get small icon
/// <summary>
/// SHGetFileInfo 获取文件信息(包括图标)
/// </summary>
[System.Runtime.InteropServices.DllImport("Shell32.dll")]
private static extern uint SHGetFileInfo(string pszPath,uint dwFileAttributes, ref SHFILEINFO psfi,uint cbfileInfo, uint uFlags);
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[MTAThread]
static void Main()
{
SHFILEINFO FI=new SHFILEINFO();
SHGetFileInfo("路径", 0, ref FI, (uint)System.Runtime.InteropServices.Marshal.SizeOf(FI), SHGFI_ICON|SHGFI_SMALLICON);
//SHGetFileInfo("路径", 0, ref FI, (uint)System.Runtime.InteropServices.Marshal.SizeOf(FI), SHGFI_ICON|SHGFI_LARGEICON);
//其中,FI.hIcon即是图标句柄
}
}
}

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧