Also, you might want to consider using TCHAR
throughout... If I'm correct, the idea would be something like this:
typedef std::basic_string<TCHAR> tstring
// Make any methods you control return tstring values. Thus, you could write:
tstring command = obj.getInstallationPath();
CreateProcess(x, command.c_str(), ...);
Note that we use CreateProcess
instead of CreateProcessW
or CreateProcessA
. The idea is that if UNICODE
is defined, then TCHAR
is typedef
ed to WCHAR
and CreateProcess
is #define
d to be CreateProcessW
, which accepts a LPWSTR
; but if UNICODE
is not defined, then TCHAR
becomes char
, and CreateProcess
becomes CreateProcessA
, which accepts a LPSTR
. But I might not have the details right here... this stuff seems somewhat needlessly complicated :(.