By using the below code, I am getting the path "C:\ProgramFiles"
And then appending "\Test\myupdate.exe" to it.
After that I am storing this path in the "pwszTaskTrigger" structure variable like as below:
mcTskInfo.pwszTaskTrigger = strexepath;
But, When storing I am getting a warning message ("no suitable conversion function from "std::wstring" to "LPWSTR" exists"):
Below is the complete Code:
MCTASKINFO mcTskInfo = { 0 };
WCHAR szCommonFiles[MAX_PATH] = { 0 };
lRet = SHGetFolderPathW(NULL, CSIDL_PROGRAM_FILES, NULL, 0, szCommonFiles);
std::wstring strexepath = L"";
strexepath.append(szCommonFiles); //szCommonFiles gives the path "C:\\ProgramFiles"
strexepath.append(ADD_MCUPDTPATH);
mcTskInfo.pwszTaskTrigger = strexepath;
#define ADD_MCUPDTPATH L"\\Test\\myupdate.exe"
struct MCTASKINFO
{
LPWSTR pwszTaskTrigger;
};
Here I should not change the structure variable pwszTaskTrigger from LPWSTR to LPCWSTR. Because this file is the include file.
How can I fix this issue without changing LPWSTR to LPCWSTR?
Aucun commentaire:
Enregistrer un commentaire