D
David student
Guest
Hello All,
In my project I found the function with std::wstring return type. And in the function, if the RegGetValue function's return value is not equal to ERROR_SUCCESS then writing the statement return L"";
Is it the correct way to use return L""; or is there any other way can we use?
And also what is the purpose of using std::wstring as the return type from this function?
Below is the code snippet:
std::wstring EmrUtils::GetPIDFromRegistry()
{
WCHAR szPID[MAX_PATH] = { 0 };
DWORD dwType = REG_SZ;
DWORD dwMaxSize = sizeof(szPID) / sizeof(WCHAR);
// Registry read
DWORD dwRet = RegGetValue(HKEY_LOCAL_MACHINE, REGKEY_INSTALL_PARAMS, REG_VALUE_PID, 0, &dwType, (LPBYTE)&szPID, &dwMaxSize);
if (ERROR_SUCCESS != dwRet)
{
return L"";
}
return szPID;
}
Continue reading...
In my project I found the function with std::wstring return type. And in the function, if the RegGetValue function's return value is not equal to ERROR_SUCCESS then writing the statement return L"";
Is it the correct way to use return L""; or is there any other way can we use?
And also what is the purpose of using std::wstring as the return type from this function?
Below is the code snippet:
std::wstring EmrUtils::GetPIDFromRegistry()
{
WCHAR szPID[MAX_PATH] = { 0 };
DWORD dwType = REG_SZ;
DWORD dwMaxSize = sizeof(szPID) / sizeof(WCHAR);
// Registry read
DWORD dwRet = RegGetValue(HKEY_LOCAL_MACHINE, REGKEY_INSTALL_PARAMS, REG_VALUE_PID, 0, &dwType, (LPBYTE)&szPID, &dwMaxSize);
if (ERROR_SUCCESS != dwRet)
{
return L"";
}
return szPID;
}
Continue reading...