I am getting text from a Window and it returns in LPTSTR. I have to turn it into string or else I have to rewrite a lot of my code. Also What is a LPTSTR and how is it different from a string?
Asked
Active
Viewed 1.7k times
2
-
4LPTSTR can be either `char*` or `wchar_t*` depending on whether or not you are using Microsoft's idea of Unicode – Captain Obvlious May 22 '13 at 04:28
-
Part of the reason to just use wide strings in the first place. – chris May 22 '13 at 04:32
1 Answers
2
LPTSTR is a string, it's just not constant.
You can use it like a regular char * if as long as you don't define UNICODE in your application. The difference between a unicode and normal string is the length of the character. In unicode it is either 2 or 4 and in standard programs it is 1 byte.
As some people might point out, you're not the only one to ask this question. This is usually a topic of confusion for people learning to program in the Windows environment. See this for some clarification, from MSDN. I'd also recommend viewing their desktop API reference for a lot of useful information that may help you with future inquiries.

tay10r
- 4,234
- 2
- 24
- 44