|
-
May 5th, 2012, 06:35 AM
#4
Re: Reading in from a dialog box
 Originally Posted by o.fithcheallaigh
I have tried a different approach [...].
Obviously. Now that defininitely is native C++ with MFC, so there's no such thing as a Text property or MessageBox::Show() or int::ToString() methods. Questions about that should better be asked in the Visual C++ section.
And I am getting an error "error C2664: 'CWnd::SetDlgItemTextA' : cannot convert parameter 2 from 'char' to 'LPCTSTR' ...Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast"
The error message is rather obvious, I'd say: The method expects an LPCTSTR, which is a synonym for either char * or wchar_t *, depending on whether it's an MBCS or Unicode build. A char isn't implicitly convertible into that (and it's definitely better that it is that way - comment by me, not the error message ).
This could serve as a quick and dirty fix:
Code:
char a[2] = {0};
// ...
a[0] = (char)*(p+1);
SetDlgItemText(IDC_EDIT2, a);
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|