The problem is not to solve really easily, because a PCTSTR comes in two flavors, depending on your compile settings. It can denote a wide character string (16-bit characters) or a so-called multi-byte character string (8-bit characters). std::string on the other hand is always a string of 8-bit characters.
So in the easier case, when your compile settings are "multi-byte characters" it's as simple as
LPCTSTR pStr = str.c_str();
In the other compile setting, for wide characters, a conversion must be done and that requires the allocation of memory for the new 16-bit character string. So you end up doing something like:
CString str2 (str.c_str());
LPCTSTR pStr = str2;
Now, the above method also works with the compile settings for "multi-byte character strings", but the intermediate creation of the CString object represents some unnecessary work in that scenario.
Here is a way that works for both compiler settings and is in both scenarios very efficient.
USES_CONVERSION;
LPCTSTR pStr = A2T (str.c_str());
See
MFC tech note 59 for more details on these ATL macros.
Don't forget that pStr stays only valid as long as you are in that same function!
I hope that gets you some ideas on how to proceed.