因为这些应用程序是不固定的
所以想在主程序启动时在ImageList中动态加载这些应用程序的图标
请各位赐教
3ks
9 个解决方案
#1
这个问题要分两步解决:
1 提取出应用程序的图标(很多这样的代码,我就不罗嗦了)
2 用ImageList中动态加载提取出来的图标(假设保存为e:\1CO\44.ico):
Private Sub Command1_Click()
Dim pic As StdPicture
Set pic = LoadPicture("e:\1CO\44.ico")
Me.ImageList1.ListImages.Add , , pic
End Sub
1 提取出应用程序的图标(很多这样的代码,我就不罗嗦了)
2 用ImageList中动态加载提取出来的图标(假设保存为e:\1CO\44.ico):
Private Sub Command1_Click()
Dim pic As StdPicture
Set pic = LoadPicture("e:\1CO\44.ico")
Me.ImageList1.ListImages.Add , , pic
End Sub
#2
如果不保存成图标文件,提取出来直接加载到ImageList中是否可以?
另外提取图标怎么保存成.ico文件?
请赐教!!!
另外提取图标怎么保存成.ico文件?
请赐教!!!
#3
没有人知道吗?
寒......
寒......
#4
我很想知道答案,帮你顶顶!参与一下,免得我以后找不到该贴!
#5
支持,我也想知道!
#6
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
'提取图标
Private Sub Command1_Click()
Dim icon_filename As String
Dim hmodule As Long
Dim x As Long
Dim icon_num As Integer
Dim icon_n As Long
icon_filename = "F:\Temp\32k\NetRiver.exe"
Picture1.Cls
hmodule = GetModuleHandle(icon_filename) '取得文件句柄
icon_n = ExtractIcon(hmodule, icon_filename, 0) '提取第一个图标
x = DrawIcon(Picture1.hdc, 0, 0, icon_n) '画出图标
End Sub
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
'提取图标
Private Sub Command1_Click()
Dim icon_filename As String
Dim hmodule As Long
Dim x As Long
Dim icon_num As Integer
Dim icon_n As Long
icon_filename = "F:\Temp\32k\NetRiver.exe"
Picture1.Cls
hmodule = GetModuleHandle(icon_filename) '取得文件句柄
icon_n = ExtractIcon(hmodule, icon_filename, 0) '提取第一个图标
x = DrawIcon(Picture1.hdc, 0, 0, icon_n) '画出图标
End Sub
#7
将图标的路径存储在数据库存中,
#8
图标还是存在imageList中,你根据不同的程序改变listbox中相关位置的图标就是了
#9
Me.ImageList1.ListImages.Add [index],[key], [picture]
#1
这个问题要分两步解决:
1 提取出应用程序的图标(很多这样的代码,我就不罗嗦了)
2 用ImageList中动态加载提取出来的图标(假设保存为e:\1CO\44.ico):
Private Sub Command1_Click()
Dim pic As StdPicture
Set pic = LoadPicture("e:\1CO\44.ico")
Me.ImageList1.ListImages.Add , , pic
End Sub
1 提取出应用程序的图标(很多这样的代码,我就不罗嗦了)
2 用ImageList中动态加载提取出来的图标(假设保存为e:\1CO\44.ico):
Private Sub Command1_Click()
Dim pic As StdPicture
Set pic = LoadPicture("e:\1CO\44.ico")
Me.ImageList1.ListImages.Add , , pic
End Sub
#2
如果不保存成图标文件,提取出来直接加载到ImageList中是否可以?
另外提取图标怎么保存成.ico文件?
请赐教!!!
另外提取图标怎么保存成.ico文件?
请赐教!!!
#3
没有人知道吗?
寒......
寒......
#4
我很想知道答案,帮你顶顶!参与一下,免得我以后找不到该贴!
#5
支持,我也想知道!
#6
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
'提取图标
Private Sub Command1_Click()
Dim icon_filename As String
Dim hmodule As Long
Dim x As Long
Dim icon_num As Integer
Dim icon_n As Long
icon_filename = "F:\Temp\32k\NetRiver.exe"
Picture1.Cls
hmodule = GetModuleHandle(icon_filename) '取得文件句柄
icon_n = ExtractIcon(hmodule, icon_filename, 0) '提取第一个图标
x = DrawIcon(Picture1.hdc, 0, 0, icon_n) '画出图标
End Sub
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
'提取图标
Private Sub Command1_Click()
Dim icon_filename As String
Dim hmodule As Long
Dim x As Long
Dim icon_num As Integer
Dim icon_n As Long
icon_filename = "F:\Temp\32k\NetRiver.exe"
Picture1.Cls
hmodule = GetModuleHandle(icon_filename) '取得文件句柄
icon_n = ExtractIcon(hmodule, icon_filename, 0) '提取第一个图标
x = DrawIcon(Picture1.hdc, 0, 0, icon_n) '画出图标
End Sub
#7
将图标的路径存储在数据库存中,
#8
图标还是存在imageList中,你根据不同的程序改变listbox中相关位置的图标就是了
#9
Me.ImageList1.ListImages.Add [index],[key], [picture]