有没有办法将图标从Shell32嵌入到Access应用程序中?
理想情况下,我希望将它们存储为图像(可能在ImageList中),但这并不重要,只要我可以在应用程序中使用它们。下面的代码看起来很接近我想要的,但是我不能使它适应VBA,因为我对VB和API的知识有限
Private Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" _
(ByVal lpszFile As String, ByVal nIconIndex As Long, phiconLarge As Long, phiconSmall As Long, ByVal nIcons As Long) As Long
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 DestroyIcon Lib "user32" _
(ByVal hIcon As Long) As Long
Private Sub Form_Load()
Dim mIcon As Long
Dim n As Integer, iCount As Long
Dim xPos As Long, yPos As Long
iCount = ExtractIconEx("C:\Windows\System32\Shell32.dll", -1, 0&, 0&, 1)
For n = 0 To iCount
ExtractIconEx "C:\Windows\System32\Shell32.dll", n, mIcon, 0&, 1&
DrawIcon Me.hwnd, 0, 0, mIcon
DestroyIcon mIcon
xPos = xPos + 32
xPos = 0
yPos = yPos + 32
Next n
End Sub发布于 2014-03-27 05:22:37
使用函数
ExtractAssociatedIcon 并将图标索引作为参数传递。
请看这篇文章:
http://www.bigresource.com/VB-Extract-Associated-Icon-to-ImageList-8vp7SQUKBe.html
https://stackoverflow.com/questions/22673173
复制相似问题