Re: Writing to registry bug

Tech-Archive recommends: Fix windows errors by optimizing your registry



<patrickparent@xxxxxxxxx> wrote in message
news:1164214452.483691.159060@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
<cut>
Declare Function RegSetValueEx Lib "Advapi32" Alias "RegSetValueExA"
(ByVal hKey As Long, ByVal lpValueName As String, ByVal RESERVED As
Long, ByVal dwType As Long, ByVal szData As String, ByVal cbData As
Long) As Long
<cut>
lResult = RegSetValueEx(keyhand, strValueName, 0&,
REG_DWORD, lData, 4)

Your declaration has "ByVal szData As String" and you are passing a Long
with the value 0 so VB is converting it to "0" and you are writing that to
the registry along with a couple of bytes of random garbage.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

.