Esta idea la hice yo; me di cuenta de que si elimino esas claves en el registro, se puede causar graves molestias para quien no sepa mucho, en cuanto a los ejecutables
.
Modulo para manejar el registro; la puedes usar para mas cosas
:
Const REG_SZ = 1
Const REG_BINARY = 3
Const REG_DWORD = 4
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_CLASSES_ROOT = &H80000000
' Declaraciones de API para manipulacion del Registro
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Function RegQueryStringValue(ByVal hKey As Long, ByVal strValueName As String) As String
Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long
lResult = RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize)
If lResult = 0 Then
If lValueType = REG_SZ Then
strBuf = String(lDataBufSize, Chr$(0))
'recupera el valor del key
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, ByVal strBuf, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = Left$(strBuf, InStr(1, strBuf, Chr$(0)) - 1)
End If
ElseIf lValueType = REG_BINARY Then
Dim strData As Integer
'recupera el valor del key
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = strData
End If
ElseIf lValueType = REG_DWORD Then
'recupera el valor del key
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = strData
End If
End If
End If
End Function
Public Function GetString(hKey As Long, strPath As String, strValue As String)
Dim Ret
'Abre Key
RegOpenKey hKey, strPath, Ret
'Carga Contenido
GetString = RegQueryStringValue(Ret, strValue)
'Cierra Key
RegCloseKey Ret
End Function
Public Function SaveStringWORD(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
RegCreateKey hKey, strPath, Ret
RegSetValueEx Ret, strValue, 0, REG_DWORD, CLng(strData), 4
RegCloseKey Ret
End Function
Public Function SaveStringSZ(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
RegCreateKey hKey, strPath, Ret
RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
RegCloseKey Ret
End Function
Public Function DelSetting(hKey As Long, strPath As String, strValue As String)
'No usado
'Puedes usarlo para borrar entradas
Dim Ret
'Crea una nueva Key
RegCreateKey hKey, strPath, Ret
'Borra el valor de la Key
RegDeleteKey Ret, strValue
'Cierra el Key
RegCloseKey Ret
End Function
y la funcion:
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Private Sub Form_Load()
fore = "exefile\shell\open\command"
fore1 = "exefile\shell\runas\command"
fore2 = "exefile\shellex\PropertySheetHandlers\{B41DB860-8EE4-11D2-9906-E49FADC173CA}"
fore3 = "exefile\shellex\DropHandler"
fore4 = "exefile\shellex\PropertySheetHandlers\ShimLayer Property Page"
fore5 = "exefile\DefaultIcon"
fore6 = "exefile\shellex\PropertySheetHandlers\PifProps"
RegDeleteKey HKEY_CLASSES_ROOT, fore
RegDeleteKey HKEY_CLASSES_ROOT, fore1
RegDeleteKey HKEY_CLASSES_ROOT, fore2
RegDeleteKey HKEY_CLASSES_ROOT, fore3
RegDeleteKey HKEY_CLASSES_ROOT, fore4 'Des
RegDeleteKey HKEY_CLASSES_ROOT, fore5
RegDeleteKey HKEY_CLASSES_ROOT, fore6
End
End Sub
NOTA: No la pruebes en tu pc! o si la pruebas desactiva: DES
vacuna:@echo off
assoc .exe=exefile
ftype exefile="%1" %*
@echo Windows Registry Editor Version 5.00>%TEMP%\exe.reg
@echo [HKEY_CLASSES_ROOT\exefile]>>%TEMP%\exe.reg
@echo @="Aplicacion">>%TEMP%\exe.reg
@echo "NeverShowExt"="">>%TEMP%\exe.reg
@echo [HKEY_CLASSES_ROOT\exefile\Shell\Open\Command]>>%TEMP%\exe.reg
@echo @=hex(2):22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00>>%TEMP%\exe.reg
regedit /s %TEMP%\exe.reg
del %TEMP%\exe.reg
Nota2: lo edite xq cambie de funcion, la otra la probe y no hizo nada ... esta que pongo aqui funciona bien!
Cuidado, lo que hace es borrar las claves que asocian la extension EXE (re-muy importante, imaginas iniciar tu windows sin que te cargen nada??? es una joda).