samedi 20 février 2021

error: cannot convert 'const CHAR**' {aka 'const char**'} to 'LPCSTR' {aka 'const char*'} in C++

I have a big chunk of code that I am debugging, and I am stuck trying to figure out why I get the following error when I try to build the project:

"error: cannot convert 'const CHAR**' {aka 'const char**'} to 'LPCSTR' {aka 'const char*'}"

The issue is with the wsKey parameter. SHRegGetValue is a function defined in the Shlwapi.h header, but I don't know how to fix this and I am inexperienced with the Windows API. Please let me know if there is a solution.

LPCSTR wsKey[MAX_PATH] = {"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"};
WCHAR wsValue[MAX_PATH] = L"ProxyEnable";
DWORD dwValue = (DWORD)FALSE;
DWORD dwSize = sizeof(dwValue);
LONG nStatus = SHRegGetValue(HKEY_CURRENT_USER, wsKey, wsValue, SRRF_RT_DWORD, NULL, &dwValue, &dwSize);

Aucun commentaire:

Enregistrer un commentaire