Would like some help on RegSetValueEx please.

Hello.

I'm trying to perform the seemingly stupid simple task of setting a registry value. but it's not working.. When i try to e

i believe the problem is directly related to the RegSetValueEx function, maybe the way i'm formatting my CString?

(don't worry about typos in the code, it's hard to format in this dang message editor)

Here is my code:

//strVal is a parameter of type CString. in this case: 192.168.2.100
//STR_IPCONFIG_KEY= key to ip registry settings
//strKey is the specific key to set.

DWORD dwType = REG_MULTI_SZ;
DWORD dwErr;
HKEY hkResult;
LONG lRet = RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
STR_IPCONFIG_KEY,
0,
KEY_ALL_ACCESS,
&hkResult
);

if ( lRet == ERROR_SUCCESS )
{

if ( dwType == REG_SZ )
{
dwErr = RegSetValueExA(
hkResult,
strKey,
0,
dwType,
(LPBYTE)(LPCTSTR)strVal,
strVal.GetLength()
);
}
}
[1156 byte] By [delphieng] at [2007-11-18 1:38:06]
# 1 Re: Would like some help on RegSetValueEx please.
never mind i'm an idiot.

:D
delphieng at 2007-11-9 13:02:49 >