I just want to be able to modify a DWORD value in the Windows Registry. I have tried everyting I can think of to make it work. I know I have the declarations right, because I can change string values all day, and I can change the DWORD value, but it isn't the value that I wanted to change it to. Here are the pertinant lines in my code:
Public Const REG_DWORD = 4
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Function SetKey(mkey As Long, subkey As String, kname As String, kval As String) As Long
Dim hregkey As Long ' receives handle to the newly created or opened registry key
Dim secattr As SECURITY_ATTRIBUTES ' security settings of the key
Dim neworused As Long ' receives 1 if new key was created or 2 if an existing key was opened
Dim hkval As Long ' value to set key to
retval = RegCreateKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, "", 0, KEY_WRITE, secattr, hregkey, neworused)
hkval = CLng(kval)
retval = RegSetValueEx(hregkey, kname, 0, REG_DWORD, ByVal hkval, REG_DWORD)

I hope someone can help.