Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
Option Explicit
Rem ===========================================================================
Rem == Typedeclaration for API-stuff. ==
Rem ===========================================================================
Private Type CLSID
id(16) As Byte
End Type
Private Type TypeIcon
cbSize As Long
picType As PictureTypeConstants
hIcon As Long
End Type
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" ( _
ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" ( _
pDicDesc As TypeIcon, _
riid As CLSID, _
ByVal fown As Long, _
lpUnknown As Object) As Long
Rem ===========================================================================
Rem == Function to retrieve an icon ressource from given file. ==
Rem ===========================================================================
'
Private Function ExtractIconFromFile(ByVal szFileName As String, ByVal lIconIndex As Long) As IPictureDisp
Dim lIconHandle As Long
Dim lRessourceHandle As Long
Dim tClassID As CLSID
Dim tNewIcon As TypeIcon
Dim tIUnknown As IUnknown
Rem =======================================================================
Rem == First step try to get a handle to the icon we want. ==
Rem =======================================================================
Set ExtractIconFromFile = Nothing
lIconHandle = ExtractIcon(&H0, szFileName, lIconIndex)
If lIconHandle <> 0 Then
Rem ===================================================================
Rem == Got a valid handle. Now try to create the icon in memory. ==
Rem ===================================================================
With tNewIcon
.cbSize = Len(tNewIcon)
.picType = vbPicTypeIcon
.hIcon = lIconHandle
End With
With tClassID
.id(8) = &HC0
.id(15) = &H46
End With
lRessourceHandle = OleCreatePictureIndirect(tNewIcon, tClassID, 1, tIUnknown)
If lRessourceHandle = 0 Then
Set ExtractIconFromFile = tIUnknown
End If
End If
End Function
Private Sub Command1_Click()
Picture1.Picture = ExtractIconFromFile("C:\Windows\System32\Shell32.dll", 1)
End Sub