Private Declare Sub SHChangeNotify Lib "shell32.dll" (ByVal wEventId As Long, _ ByVal uFlags As Long, ByVal dwItem1 As Long, ByVal dwItem2 As Long) Const SHCNE_ASSOCCHANGED = &H8000000 Const SHCNF_IDLIST = 0
Sub CreateFileAssociation(ByVal Extension As String, ByVal ClassName As String, _ ByVal Description As String, ByVal ExeProgram As String) Const HKEY_CLASSES_ROOT = &H80000000 If Left(Extension, 1) <> "." Then Extension = "." & Extension End If CreateRegistryKey HKEY_CLASSES_ROOT, Extension SetRegistryValue HKEY_CLASSES_ROOT, Extension, "", ClassName CreateRegistryKey HKEY_CLASSES_ROOT, ClassName & "\Shell\Open\Command" SetRegistryValue HKEY_CLASSES_ROOT, ClassName & "\Shell\Open\Command", "", _ ExeProgram & " ""%1"""
SHChangeNotify SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0 End Sub |