Tema: helppp
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/01/2009, 02:57
Avellaneda
Colaborador
 
Fecha de Ingreso: enero-2008
Ubicación: Unas veces aquí, otras veces allí
Mensajes: 1.482
Antigüedad: 16 años, 3 meses
Puntos: 37
Respuesta: helppp

Cita:
Iniciado por kakoxvid Ver Mensaje
ya cache que habia que editarlo desde el registro para que me pescara y funko perfecto ahora si alguien sabe como podria hacerlo desde visual esto para que cuando corra el programita me lo arregle de inmediato
asi tiene que quedar el registro

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Text
"Format" = "TabDelimited"
Código:
' en la parte de declaraciones del módulo:
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private 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
Private 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

Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1

' en el Load del Form o un CommandButton:
Dim lRet As Long, sSep As String
' leer el registro para comprobar el separador
RegOpenKey HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Jet\4.0\Engines\Text", lRet
sSep = LeerRegistro(lRet, "Format")
RegCloseKey lRet
If sSep <> "TabDelimited" Then
    ModificarRegistro HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Jet\4.0\Engines\Text", "Format", "TabDelimited"
End If

' Funciones para leer y modificar el registro:
Function LeerRegistro(ByVal HK_LM As Long, ByVal sValor As String) As String
Dim lRet As Long, lLen As Long, sBuffer As String
lRet = RegQueryValueEx(HK_LM, sValor, 0, 0, ByVal 0, lLen)
If lRet = 0 Then
    sBuffer = String(lLen, Chr$(0))
    lRet = RegQueryValueEx(HK_LM, sValor, 0, 0, ByVal sBuffer, lLen)
    If lRet = 0 Then
        LeerRegistro = Left$(sBuffer, InStr(1, sBuffer, Chr$(0)) - 1)
    End If
End If
End Function
'

Sub ModificarRegistro(HKLM As Long, sPath As String, sClave As String, sDatos As String)
Dim lRet As Long, hKey As Long
lRet = RegCreateKey(HKLM, sPath, hKey)
lRet = RegSetValueEx(hKey, sClave, 0, REG_SZ, ByVal sDatos, Len(sDatos))
lRet = RegCloseKey(hKey)
End Sub
Saludos