The solution is actually a lot easier than any of the other suggestions:
std::wstring stemp = std::wstring(s.begin(), s.end());
LPCWSTR sw = stemp.c_str();
Best of all, it’s platform independent.
More Related Contents:
- Title Name not showing and background color not changing
- Windows LoadCursor – Does it return the same HCURSOR value each time?
- How to get main window handle from process id?
- Win32 API to enumerate dll export functions?
- How to get the error message from the error code returned by GetLastError()?
- How to read a value from the Windows registry
- CreateProcess from memory buffer
- How do I call ::CreateProcess in c++ to launch a Windows executable?
- C++ #include is not found
- #define NOMINMAX using std::min/max
- Detecting Windows 10 version
- Win32 programming hiding console window
- How to get the cpu usage per thread on windows (win32)
- Detect if program is running with full administrator rights
- How do I redirect output to a file with CreateProcess?
- Keyboard Input & the Win32 message loop
- updating a string table with UpdateResource
- Is there a way to find all the functions exposed by a dll
- Read process memory of a process does not return everything
- How can I get the path of a Windows “special folder” for a specific user?
- C++ Executing CMD Commands
- How to use WndProc as a class function [duplicate]
- Check the file-size without opening file in C++?
- Win32: How to hide 3rd party windows in taskbar by hWnd
- Is there a clean way to prevent windows.h from creating a near & far macro?
- Explicitly initialize DWORD to 1, but debugger shows wildly out of range value
- How to check if a process has the administrative rights
- How to get the Executable name of a window
- How do I guarantee fast shutdown of my win32 app?
- How to get the path of an active file explorer window in c++ winapi