CXX0030 error:expression cannot be valuated

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?
 
D

David Wilkinson

Gro.LG said:
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?

Gro:

TCHAR childkey[100] = _T("SOFTWARE");

would be a good start. VS2005 applications enable UNICODE by default.

David Wilkinson
 
G

Guest

thanks for your posts.thanks. I have try kinds of solutions include yours.But
the error occurs in my every try .such as:
1.Change the default Character Set as Multi-Byte Character Set or Unicode
Character Set.
2.Use MultiByteToWideChar to convert Character Set.
3.Use RegDeleteKeyValue instead,but there is error:identier is not define.
I have spend a week on this program,It's crazy.But how can I?
thank you!

--
No weapon that is formed against you will prevail; and you will condemn
every tongue that rises against you in judgment.


David Wilkinson said:
Gro.LG said:
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?

Gro:

TCHAR childkey[100] = _T("SOFTWARE");

would be a good start. VS2005 applications enable UNICODE by default.

David Wilkinson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top