IcoSetupFile




'DICHIARAZIONI

Private Declare Function RegSetValue& Lib "advapi32.DLL" Alias
"RegSetValueA" (ByVal hKey&, ByVal lpszSubKey$, ByVal fdwType&, ByVal
lpszValue$, ByVal dwLength&)
Private Const MAX_PATH = 256&
'NELLA FUNZIONE AddPerAppPath

Dim rc As Long
rc = Associate(strAppExe, strAppDir & strAppExe, ".ext")
''gestione errore

'FUNZIONE DI ASSOCIAZIONE

Private Function Associate(ByVal apTitle As String, apPath As String, ByVal
Ext As String) As Integer
Dim ret&
Dim lphKey&
Associate = 1
ret& = OSRegCreateKey&(HKEY_CLASSES_ROOT, Ext, lphKey&)
If ret& <> 0 Then Exit Function
ret& = RegSetValue&(lphKey&, "", REG_SZ, apTitle, 0&)
If ret& <> 0 Then Exit Function
ret& = OSRegCreateKey&(HKEY_CLASSES_ROOT, apTitle, lphKey&)
If ret& <> 0 Then Exit Function
ret& = RegSetValue&(lphKey&, "shell\open\command", REG_SZ, apPath & " %1",MAX_PATH)
If ret& <> 0 Then Exit Function
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, apTitle, lphKey&)
If ret& <> 0 Then Exit Function
ret& = RegSetValue&(lphKey&, "DefaultIcon", REG_SZ, apPath , MAX_PATH)
If ret& <> 0 Then Exit Function
Associate = 0
End Function











( icosetupfile.html )- by Paolo Puglisi - Modifica del 17/12/2023