G
Guest
In visual studio 2005 I have built a simple win32 console programm.the code
as follows:
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
LONG res,res1;
HKEY hkey;
CHAR childkey[100] ="SOFTWARE";
res = RegOpenKeyEx(HKEY_LOCAL_MACHINE,childkey,NULL,
KEY_WRITE||KEY_READ||KEY_SET_VALUE, &hkey);
res1 = RegDeleteValue(hkey,_T("ttt"));
return 0;
}
when I start this programm without debugging,there is no error.But the
function RegDeleteValue doesn't work.when I use debugging,&hkey show me the
error like the title,but return value of RegDeleteValue is 0.
here res1=2,when I use RegDeleteValue(HKEY_LOCAL_MACHINE,_T("ttt")),it
works well.so,can you help me?
as follows:
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
LONG res,res1;
HKEY hkey;
CHAR childkey[100] ="SOFTWARE";
res = RegOpenKeyEx(HKEY_LOCAL_MACHINE,childkey,NULL,
KEY_WRITE||KEY_READ||KEY_SET_VALUE, &hkey);
res1 = RegDeleteValue(hkey,_T("ttt"));
return 0;
}
when I start this programm without debugging,there is no error.But the
function RegDeleteValue doesn't work.when I use debugging,&hkey show me the
error like the title,but return value of RegDeleteValue is 0.
here res1=2,when I use RegDeleteValue(HKEY_LOCAL_MACHINE,_T("ttt")),it
works well.so,can you help me?