Link to home
Start Free TrialLog in
Avatar of scooter1
scooter1

asked on

Registry

What's wrong with this:

CString newpass = "Hello";
char var2[20];
strcpy(var2, (LPCSTR)newpass); // copies the string

HKEY MyKey;
DWORD dwcbData = sizeof(var2);

RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\WinM",0,KEY_ALL_ACCESS,&MyKey);
RegSetValueEx(MyKey, "WinM", 0, REG_SZ, (LPBYTE)&var2, dwcbData);
RegSaveKey(MyKey, "WinM", NULL);
RegCloseKey(MyKey);
ASKER CERTIFIED SOLUTION
Avatar of xLs
xLs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scooter1
scooter1

ASKER

it exist from a previous creation, are you suggesting i dont' need RegSaveKey() ?  and is my conversion of string to char right ?