Hier mal eine Alternative zu [Allgemein] Icons aus exe, dll oder ico extrahieren/verwenden
Beispiel:
(umgeschrieben von Dominique Vandensteen's Code)
VB.NET-Quellcode
- Public Declare Function DestroyIcon Lib "User32.dll" (ByRef phicon As IntPtr) As Boolean
- Public Declare Function ExtractIconEx Lib "shell32.dll" (ByVal lpszFile As String, ByVal nIconIndex As Integer, _
- ByRef phiconLarge As IntPtr, ByRef phiconSmall As IntPtr, ByVal nIcons As Integer) As IntPtr
- Public Function GetApplicationIcon(ByVal Filepath As String, ByVal smallIcon As Boolean, Optional ByVal NrOfIcon As Integer = 0) As Icon
- Dim iconPtr As IntPtr
- Dim myIcon As Icon
- If smallIcon = True Then
- ExtractIconEx(Filepath, NrOfIcon, Nothing, iconPtr, 1)
- Else
- ExtractIconEx(Filepath, NrOfIcon, iconPtr, Nothing, 1)
- End If
- Try
- myIcon = Icon.FromHandle(iconPtr)
- Catch ex As Exception
- Return Nothing
- End Try
- DestroyIcon(iconPtr)
- Return myIcon
- End Function
Beispiel:
(umgeschrieben von Dominique Vandensteen's Code)
Für ein Mindestmaß an Rechtschreibung, Interpunktion und Majuskeln!
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „bla“ ()