How to Convert LPWSTR To string ?
I looked but did not find.
Note: I used a compiler MinGW With NetBeans IDE .
Last edited on
Sorry but that does not work , I used a compiler MinGW With NetBeans IDE .
As already said there, use WideCharToMultiByte() then construct your std::string.
Your code posted has multiple errors, it will crash at runtime even if you make it compile.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
WCHAR* DES_folder = new WCHAR[MAX_PATH];
HRESULT hr = SHGetFolderPathW(0, CSIDL_DESKTOP, 0, 0, DES_folder);
if (SUCCEEDED (hr)) {
std::wstring str1 = DES_folder;
str1 += L"\\printscrin.lnk";
CreateShortCut(L"C:\\Users\\win7\\Documents\\NetBeansProjects\\CppApplication_20\\printscren.exe"
, str1.c_str()
, L"my appliaction"
);
}
delete [] DES_folder;
|
This should work.
Last edited on