파일에서 아이콘을 추출해야하지만 첫 번째 아이콘은 추출 할 필요가 없으므로 vb.net 아이콘 추출 기능을 사용할 수 없습니다. 이 작업을 수행해야하는 WIN32API 함수는 정수 배열에 대한 포인터를 필요로합니다.vb.net win32api 정수 배열 매개 변수에 대한 포인터
어떻게이 유형을 매개 변수로 제공 할 수 있습니까?
Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" _
(ByVal lpszFile As String, _
ByVal nIconIndex As Integer, _
ByRef phiconLarge As Integer, _
ByRef phiconSmall As Integer, _
ByVal nIcons As Long) As Integer
Dim icons As integer()
ExtractIconEx("%systemroot%/shell32.dll", 15, icons, 0, 5)
은 내가 System.Reflection.Pointer
클래스?/네임 스페이스에서 거위의 수컷을 촬영했습니다?하지만 문서는 스파 스 및 합리적인보다 작습니다. 후속 호출은 항상 예외 (Value cannot be null
)을 일으킬
<Runtime.InteropServices.DllImport("shell32.dll", _
CharSet:=Runtime.InteropServicesCharSet.Auto)> _
Shared Function ExtractIconEx(ByVal szFileName As String, _
ByVal nIconIndex As Integer, _
ByRef phiconLarge() As IntPtr, _
ByRef phiconSmall() As IntPtr, _
ByVal nIcons As UInteger) As UInteger
End Function
...
Dim icons(8) As IntPtr, smicons(8) As IntPtr
MsgBox(ExtractIconEx("%systemroot%/shell32.dll", 15, icons, smicons, 1))
Try
MsgBox(icons.Count)
Catch ex As Exception
MsgBox(ex.Message & " by " & ex.Source)
End Try
...
:
IntPtr
좋아 텍사스 afaikt 배열에 대한 지원을 제공하지 않습니다 난에 서명을 해결하기 위해 관리했습니다. 반환 값은 4294967295
이며 최대 32 비트 정수 값입니다.
이 아이디어를 길들여 작동시키는 방법에 대한 아이디어가 있으십니까?
http://pinvoke.net/default.aspx/shell32/ExtractIconEx.html –