elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  ayuda vb6
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ayuda vb6  (Leído 1,894 veces)
jorgelin95

Desconectado Desconectado

Mensajes: 38


Ver Perfil
ayuda vb6
« en: 1 Septiembre 2010, 03:45 am »

hola a todos necesit hacer q un command modifique algo del registro (regedit) se podria y como? gracias


En línea

xkiz ™


Desconectado Desconectado

Mensajes: 1.252


Ver Perfil WWW
Re: ayuda vb6
« Respuesta #1 en: 1 Septiembre 2010, 05:07 am »

RegSetValueEx Function


En línea

jorgelin95

Desconectado Desconectado

Mensajes: 38


Ver Perfil
Re: ayuda vb6
« Respuesta #2 en: 1 Septiembre 2010, 14:37 pm »

no entendi osea masomenos, cuando agrego el code


Private Sub Command1_Click()

End Sub
 
y pongo el handle me tira error yo lo que quiero al hacer click en un command ¿como seria?
En línea

Horricreu
Wiki

Desconectado Desconectado

Mensajes: 290

¡La verdad os hará libres!


Ver Perfil WWW
Re: ayuda vb6
« Respuesta #3 en: 1 Septiembre 2010, 14:55 pm »

Hay cientos de códigos, en la misma MSDN hay. Puedes mirar acá donde discuten también sobre el registro de Windows, pero los códigos están en C/C++. No te costará mucho traducirlo... :silbar:

Saludos :P
En línea

xkiz ™


Desconectado Desconectado

Mensajes: 1.252


Ver Perfil WWW
Re: ayuda vb6
« Respuesta #4 en: 1 Septiembre 2010, 17:20 pm »

hay un programa que se llama Api Guide que tiene muchos ejemplo de Api de Windows, es una herramienta muy util para Visual Basic...
En línea

BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: ayuda vb6
« Respuesta #5 en: 1 Septiembre 2010, 19:01 pm »


Sacado de la API Guide:

Código
  1.  
  2. 'This program needs 3 buttons
  3. Const REG_SZ = 1 ' Unicode nul terminated string
  4. Const REG_BINARY = 3 ' Free form binary
  5. Const HKEY_CURRENT_USER = &H80000001
  6. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  7. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  8. Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
  9. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  10. 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
  11. 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
  12. Function RegQueryStringValue(ByVal hKey As Long, ByVal strValueName As String) As String
  13.    Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long
  14.    'retrieve nformation about the key
  15.    lResult = RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize)
  16.    If lResult = 0 Then
  17.        If lValueType = REG_SZ Then
  18.            'Create a buffer
  19.            strBuf = String(lDataBufSize, Chr$(0))
  20.            'retrieve the key's content
  21.            lResult = RegQueryValueEx(hKey, strValueName, 0, 0, ByVal strBuf, lDataBufSize)
  22.            If lResult = 0 Then
  23.                'Remove the unnecessary chr$(0)'s
  24.                RegQueryStringValue = Left$(strBuf, InStr(1, strBuf, Chr$(0)) - 1)
  25.            End If
  26.        ElseIf lValueType = REG_BINARY Then
  27.            Dim strData As Integer
  28.            'retrieve the key's value
  29.            lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
  30.            If lResult = 0 Then
  31.                RegQueryStringValue = strData
  32.            End If
  33.        End If
  34.    End If
  35. End Function
  36. Function GetString(hKey As Long, strPath As String, strValue As String)
  37.    Dim Ret
  38.    'Open the key
  39.    RegOpenKey hKey, strPath, Ret
  40.    'Get the key's content
  41.    GetString = RegQueryStringValue(Ret, strValue)
  42.    'Close the key
  43.    RegCloseKey Ret
  44. End Function
  45. Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String)
  46.    Dim Ret
  47.    'Create a new key
  48.    RegCreateKey hKey, strPath, Ret
  49.    'Save a string to the key
  50.    RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
  51.    'close the key
  52.    RegCloseKey Ret
  53. End Sub
  54. Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String)
  55.    Dim Ret
  56.    'Create a new key
  57.    RegCreateKey hKey, strPath, Ret
  58.    'Set the key's value
  59.    RegSetValueEx Ret, strValue, 0, REG_BINARY, CByte(strData), 4
  60.    'close the key
  61.    RegCloseKey Ret
  62. End Sub
  63. Sub DelSetting(hKey As Long, strPath As String, strValue As String)
  64.    Dim Ret
  65.    'Create a new key
  66.    RegCreateKey hKey, strPath, Ret
  67.    'Delete the key's value
  68.    RegDeleteValue Ret, strValue
  69.    'close the key
  70.    RegCloseKey Ret
  71. End Sub
  72. Private Sub Command1_Click()
  73.    Dim strString As String
  74.    'Ask for a value
  75.    strString = InputBox("Please enter a value between 0 and 255 to be saved as a binary value in the registry.", App.Title)
  76.    If strString = "" Or Val(strString) > 255 Or Val(strString) < 0 Then
  77.        MsgBox "Invalid value entered ...", vbExclamation + vbOKOnly, App.Title
  78.        Exit Sub
  79.    End If
  80.    'Save the value to the registry
  81.    SaveStringLong HKEY_CURRENT_USER, "KPD-Team", "BinaryValue", CByte(strString)
  82. End Sub
  83. Private Sub Command2_Click()
  84.    'Get a string from the registry
  85.    Ret = GetString(HKEY_CURRENT_USER, "KPD-Team", "BinaryValue")
  86.    If Ret = "" Then MsgBox "No value found !", vbExclamation + vbOKOnly, App.Title: Exit Sub
  87.    MsgBox "The value is " + Ret, vbOKOnly + vbInformation, App.Title
  88. End Sub
  89. Private Sub Command3_Click()
  90.    'Delete the setting from the registry
  91.    DelSetting HKEY_CURRENT_USER, "KPD-Team", "BinaryValue"
  92.    MsgBox "The value was deleted ...", vbInformation + vbOKOnly, App.Title
  93. End Sub
  94. Private Sub Form_Load()
  95.    'KPD-Team 1998
  96.    'URL: http://www.allapi.net/
  97.    'E-Mail: KPDTeam@Allapi.net
  98.    Command1.Caption = "Set Value"
  99.    Command2.Caption = "Get Value"
  100.    Command3.Caption = "Delete Value"
  101. End Sub
  102.  
  103.  

Dulces Lunas!¡.
En línea

The Dark Shadow is my passion.
jorgelin95

Desconectado Desconectado

Mensajes: 38


Ver Perfil
Re: ayuda vb6
« Respuesta #6 en: 2 Septiembre 2010, 04:55 am »

trate de aserlo cambiandolo a dword ya q esta en binary pero no logre como seria yo quiero que cambie un dword de HKEY_CURREN_USER/Software/Valve/Half-Life/Settings y modifcar el dword engined3d se podria me deskargue el api guide me fije en examples (lo tome como base) y vi los parametros pero no pudee
En línea

BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: ayuda vb6
« Respuesta #7 en: 2 Septiembre 2010, 06:29 am »

.
Elimina el registro y vuelvelo a crear del tipo deseado!¡.

Dulces Lunas!¡.
En línea

The Dark Shadow is my passion.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines