Private Sub AsociarApp(Byval Programa as string, Byval Extension as string)
Dim lngRc As Long, lngLphKey As Long
Const HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1
Const MAX_PATH = 260
Programa = Programa & " %1"
lngRc = RegCreateKey(HKEY_CLASSES_ROOT, Extension, lngLphKey)
lngRc = RegSetValue(lngLphKey, "", REG_SZ, "MiExtension_auto_file", 0)
lngRc = RegCreateKey(HKEY_CLASSES_ROOT, "MiExtension_auto_file", lngLphKey)
lngRc = RegSetValue(lngLphKey, "", REG_SZ, "Descripción de mi programa", 0)
lngRc = RegCreateKey(HKEY_CLASSES_ROOT, "MiExtension_auto_file", lngLphKey)
lngRc = RegSetValue&(lngLphKey, "DefaultIcon", REG_SZ, "C:\VíaDeAcceso\MiIcono.Ico", MAX_PATH)
lngRc = RegCreateKey(HKEY_CLASSES_ROOT, "MiExtension_auto_file", lngLphKey)
lngRc = RegSetValue&(lngLphKey, "shell\open\command", REG_SZ, Programa, MAX_PATH)
End Sub