Click here to Skip to main content
15,888,057 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblems with structures Pin
rahul.kulshreshtha22-Jul-11 20:45
rahul.kulshreshtha22-Jul-11 20:45 
QuestionRe: Problems with structures Pin
Rajesh R Subramanian22-Jul-11 21:04
professionalRajesh R Subramanian22-Jul-11 21:04 
AnswerRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 21:31
rahul.kulshreshtha22-Jul-11 21:31 
AnswerRe: Problems with structures Pin
Rajesh R Subramanian22-Jul-11 21:37
professionalRajesh R Subramanian22-Jul-11 21:37 
GeneralRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 22:05
rahul.kulshreshtha22-Jul-11 22:05 
GeneralRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 22:13
rahul.kulshreshtha22-Jul-11 22:13 
AnswerRe: Problems with structures Pin
John R. Shaw23-Jul-11 7:47
John R. Shaw23-Jul-11 7:47 
QuestionHow can CString be converted to LPCTSTR without any operator()? Pin
Dean Seo22-Jul-11 17:09
Dean Seo22-Jul-11 17:09 
Hi, I have been looking for the answer to this for a long time using google and everything.
I may have found some postings, but those didn't fully help me to understand this.

So I checked CStringT and CSimpleStringT, and what I found is that there is only this, "operator PCXSTR()"
This seems to say that CString, which is simply CSTringT<TCHAR>, can be converted ONLY to PCXSTR.

However, this code below works fine.

----------------------------------------------
CString m_str = TEXT("abcd");
LPCTSTR m_lpctstr = _str; // success
----------------------------------------------

Based on the fact that there is one operator method, which is operator PCXSTR(), I guess the complier just casts PCXSTR into LPCTSTR automatically, because this code below again works also fine.

----------------------------------------------
CString m_str = TEXT("abcd");
LPCTSTR m_lpctstr = (LPCTSTR)_str; // success
----------------------------------------------

Is this correct? Type PCXSTR is just converted to type LPCTSTR, which makes it seems that CString is also converted to LPCTSTR as if CString has LPCTSTR operator?

(I am, of course, talking about this in UNICODE circumstance by the way)

I think I know that I misunderstand something that could be critical, but I don't even know
where to start to solve this.

Thanks in advance.
AnswerRe: How can CString be converted to LPCTSTR without any operator()? Pin
Rajesh R Subramanian22-Jul-11 21:06
professionalRajesh R Subramanian22-Jul-11 21:06 
GeneralRe: How can CString be converted to LPCTSTR without any operator()? Pin
Mark Salsbery23-Jul-11 6:20
Mark Salsbery23-Jul-11 6:20 
GeneralRe: How can CString be converted to LPCTSTR without any operator()? Pin
Rajesh R Subramanian23-Jul-11 7:05
professionalRajesh R Subramanian23-Jul-11 7:05 
QuestionRe: How can CString be converted to LPCTSTR without any operator()? Pin
Dean Seo24-Jul-11 2:10
Dean Seo24-Jul-11 2:10 
AnswerRe: How can CString be converted to LPCTSTR without any operator()? Pin
Rajesh R Subramanian24-Jul-11 3:20
professionalRajesh R Subramanian24-Jul-11 3:20 
GeneralRe: How can CString be converted to LPCTSTR without any operator()? Pin
Dean Seo25-Jul-11 16:44
Dean Seo25-Jul-11 16:44 
QuestionAfxGetMainWnd() equals to AfxGetMainWnd ? Pin
yu-jian21-Jul-11 16:24
yu-jian21-Jul-11 16:24 
AnswerRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Mark Salsbery21-Jul-11 17:06
Mark Salsbery21-Jul-11 17:06 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
yu-jian25-Jul-11 4:16
yu-jian25-Jul-11 4:16 
AnswerRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan21-Jul-11 22:05
mveRichard MacCutchan21-Jul-11 22:05 
AnswerRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Stefan_Lang22-Jul-11 0:20
Stefan_Lang22-Jul-11 0:20 
JokeRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»22-Jul-11 2:30
professional«_Superman_»22-Jul-11 2:30 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan22-Jul-11 4:18
mveRichard MacCutchan22-Jul-11 4:18 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»22-Jul-11 6:03
professional«_Superman_»22-Jul-11 6:03 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan22-Jul-11 22:58
mveRichard MacCutchan22-Jul-11 22:58 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
«_Superman_»23-Jul-11 4:01
professional«_Superman_»23-Jul-11 4:01 
GeneralRe: AfxGetMainWnd() equals to AfxGetMainWnd ? Pin
Richard MacCutchan23-Jul-11 4:25
mveRichard MacCutchan23-Jul-11 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.