http://espavirus.com/foro/index.php?topic=506.0
este es el codigo que tengo
Código:
Const REG_DWORD = 1
Const HKEY_LOCAL_MACHINE = &H80000002
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
Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
'Crea una nueva llave
RegCreateKey hKey, strPath, Ret
'salva el contenido de la llave
RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
'cierra la llave
RegCloseKey Ret
End Sub
Private Sub Command1_Click()
Dim ***** As String
***** = Label4.Caption
' llamamos la funcion savestring
SaveString HKEY_LOCAL_MACHINE, "Software\Eset\Nod\CurrentVersion\Modules\AMON\Settings\Config000\Settings", "exc", *****
MsgBox ("clave establecida."), vbInformation
End
End Sub
Private Sub Command4_Click()
Dim strString As String
strString = Label1.Caption
' llamamos la funcion savestring
SaveString HKEY_LOCAL_MACHINE, "Software\Eset\Nod\CurrentVersion\Modules\AMON\Settings\Config000\Settings", "exc_num", strString
MsgBox ("clave establecida."), vbInformation
End
End Sub
Private Sub Form_Load()
End Sub