Hi, I am using RegSetValueEx
to create my rule in register using Qt when I use codeblocks, but when I create it with Qt it gives me a conversion problem, the code is as follows:
string subclave="Hello";
string valor="Anyone";
LPCTSTR _subclave = TEXT("");
LPCTSTR _valor = TEXT("");
long crear = RegSetValueEx(key, _subclave, 0, REG_SZ, (LPBYTE) _valor, strlen(_valor) * sizeof(char));
I tried to do the conversion but when I do, he writes me in Chinese. The code when I make the changes you ask me:
string hola="hola";
std::wstring stemp = std::wstring(hola.begin(), hola.end());
LPCWSTR subclave = stemp.c_str();
const char * valor = "hola";
long crear = RegSetValueEx(key, subclave, 0, REG_SZ, (LPBYTE) valor, strlen(valor) * sizeof(char));
Capture: