Re: Setting Registry Value
what's your API declaration?
hi,brt
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
Re: Setting Registry Value
Public Declare Function RegSetValueExA Lib "advapi32.dll" _
(ByVal hKey As Long, ByVal lpValueName As _
String, ByVal Reserved As Long, ByVal dwType As Long, ByVal _
lpValue As Any, ByVal cbData As Long) As Long
Re: Setting Registry Value
try this:
dim strData as string
strData= "10"
RegFuncRetval = RegSetValueExA _
(phk, _
"Status_Code", 0&, REG_DWORD, ByVal strData, LenB(StrConv(strData, vbFromUnicode)) + 1)
hi,brt
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
Re: Setting Registry Value
Nope, it didn't work. Gives the same error code
i.e., 998
Regards.
Re: Setting Registry Value
sorry U must use REG_SZ instead of REG_DWORD..
hi,brt
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
Re: Setting Registry Value
It puts the ASCII codes for the chars that make up the string. So for "10" it sets the value to
3031 in Hex .How do I work this around?
Re: Setting Registry Value
Sub RegWrite(RegKey As String, RegValue As Integer)
'==============================================
Dim RegEdit As Object
' Create the RegEdit Object
Set RegEdit = CreateObject("WScript.Shell")
' Set The Value
RegEdit.RegWrite RegKey, RegValue, "REG_DWORD"
Set RegEdit = Nothing
End Sub
This will enter the DWORD value to the registry
Iouri Boutchkine
[email protected]