0

有没有办法将 Shell32 中的图标嵌入到 Access 应用程序中?

理想情况下,我希望将它们存储为图像(可能在 ImageList 中),但这并不重要,只要我可以在应用程序中使用它们。看来以下代码与我想要的很接近,但由于我对 VB 和 API 的了解有限,我无法将其适应 VBA

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
4

1 回答 1

0

使用功能

ExtractAssociatedIcon 

并将图标索引作为参数传递。

看到这个帖子:

http://www.bigresource.com/VB-Extract-Associated-Icon-to-ImageList-8vp7SQUKBe.html

于 2014-03-26T21:22:36.990 回答