Visual Basic - yo denuevo

Life is soft - evento anual de software empresarial
 
Vista:

yo denuevo

Publicado por Ayuda porfa (por 3ra VEZ) (43 intervenciones) el 13/09/2001 19:22:19
Hola, mi problema es que no puedo lograr escribir en alguna cadena predeterminada del RegEdit de Windows.
Coloco el siguiente código:
Call savestring(HKEY_CLASSES_ROOT, "\folder\Shell\Cambiar Icono\command", "", App.Path & "\Iconos.exe %1")

nose como hacer para escribir en la cadena predeterminada del command, en cambio si coloco algo así:
Call savestring(HKEY_CLASSES_ROOT, "\folder\Shell\Cambiar Icono\command", "CUALQUIER_COSA", App.Path & "\Iconos.exe %1")

si me resulta pero no me sirve porque no lo escribe en el predetereminado....

Por favor si alguien puede ayudarme, ruego que lo haga gracias...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:yo denuevo

Publicado por Javier Perez (170 intervenciones) el 14/09/2001 12:47:55
Puedes utilizar la siguiente función:

Public Function EstablecerValorRegistro(ByVal hKey As Long, ByVal lpSubKey As String, ByVal lpValueName As String, ByVal lpData As String) As Long

Dim ret As Long
Dim phkResult As Long
Dim lpdwDisposition As Long
Dim lpcbData As Long

'lpSubKey = lpSubKey + Chr$(0)
ret = RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, phkResult)
If ret <> 0 Then
ret = RegCreateKeyEx(hKey, lpSubKey, ByVal 0&, ByVal 0&, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS Or KEY_CREATE_SUB_KEY, 0, phkResult, lpdwDisposition)
End If
If ret = 0 Then
'lpValueName = lpValueName + Chr$(0)
'lpData = lpData + Chr$(0)
lpcbData = Len(lpData)
ret = RegSetValueEx(phkResult, lpValueName, 0, REG_SZ, ByVal lpData, lpcbData)
RegCloseKey (phkResult)
End If

EstablecerValorRegistro = ret

End Function

La siguiente llamada escribe un valor de cadena predeterminada:

EstablecerValorRegistro HKEY_CURRENT_USER, "Software\YO", "", "UnValorPredeterminado"

Nota: utiliza el visor de API para obtener la declaración de las funciones y constantes que se usan en esta función.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar