Click here to Skip to main content
15,919,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Not so simple Pin
Stuart Dootson17-Aug-02 11:35
professionalStuart Dootson17-Aug-02 11:35 
GeneralRe: A strange compiler error C2440 Pin
Stuart Dootson17-Aug-02 21:59
professionalStuart Dootson17-Aug-02 21:59 
GeneralRe: A strange compiler error C2440 Pin
Mike Nordell17-Aug-02 23:25
Mike Nordell17-Aug-02 23:25 
GeneralNeed a help with CDialog and WM_QWERYENDSESSION Pin
Pavel Sokolov16-Aug-02 13:19
Pavel Sokolov16-Aug-02 13:19 
GeneralRe: Need a help with CDialog and WM_QWERYENDSESSION Pin
Daniel Ferguson16-Aug-02 21:05
Daniel Ferguson16-Aug-02 21:05 
GeneralRe: Need a help with CDialog and WM_QWERYENDSESSION Pin
Pavel Sokolov17-Aug-02 0:16
Pavel Sokolov17-Aug-02 0:16 
GeneralReal document in View Pin
RocardoS16-Aug-02 13:00
sussRocardoS16-Aug-02 13:00 
GeneralMFC newbie needs help with CString Pin
Raskolnikov16-Aug-02 12:42
Raskolnikov16-Aug-02 12:42 
I am reading "Introduction to MFC Programming with Visual C++" by Richard M. Jones. I am new to MFC and Win 32, and Visual Studio, but am otherwise a proficient and experienced programmer.

I am trying the second example from the book and it is not working as expected. Instead of a string as output all I get is integer (probably the memory address of the CString object).

#include <afx.h><br />
<br />
#include <iostream>  // orignally iosteam.h<br />
using namespace std; // I added this line as well<br />
<br />
int main()<br />
{<br />
	CString s;<br />
	CString sa("Strings ");<br />
	CString sb = CString("are easy ");<br />
	CString sc = "in MFC!";<br />
	s = sa + sb + sc + '!';<br />
	cout << s;<br />
<br />
	::Sleep(2000); // I added this line<br />
	return 0;<br />
}


As specified in the book I created a Win 32 Console App then specified "Use MFC in a shared DLL" and then built it in debug mode. I tried this with both 6.0 and .NET. The book is suposed to cover 6.0.

What is going wrong?

PS I changed the code to
cout << s.GetString();
Which works, is the book simply mistaken, out of date (it claims to cover 6.0) or am I configuring the project wrong in some way?
GeneralRe: MFC newbie needs help with CString Pin
valikac16-Aug-02 13:14
valikac16-Aug-02 13:14 
GeneralRe: MFC newbie needs help with CString Pin
Christian Graus16-Aug-02 13:19
protectorChristian Graus16-Aug-02 13:19 
GeneralCString Trim Pin
Shotgun16-Aug-02 12:26
Shotgun16-Aug-02 12:26 
GeneralRe: CString Trim Pin
Michael Dunn16-Aug-02 12:32
sitebuilderMichael Dunn16-Aug-02 12:32 
GeneralRe: CString Trim Pin
Shotgun16-Aug-02 12:38
Shotgun16-Aug-02 12:38 
QuestionCan we put an Icon (Shortcut) for an application with Visual C++ 6.0 MFC in Run Time? Pin
Anonymous16-Aug-02 11:15
Anonymous16-Aug-02 11:15 
AnswerRe: Can we put an Icon (Shortcut) for an application with Visual C++ 6.0 MFC in Run Time? Pin
Anonymous16-Aug-02 12:00
Anonymous16-Aug-02 12:00 
GeneralRe: I tried & failed Pin
ATC16-Aug-02 13:41
ATC16-Aug-02 13:41 
QuestionReturn to the previous active window? Pin
Matt Eckerson16-Aug-02 11:15
Matt Eckerson16-Aug-02 11:15 
AnswerRe: Return to the previous active window? Pin
Matt Eckerson16-Aug-02 19:38
Matt Eckerson16-Aug-02 19:38 
QuestionCan we put an Icon (Shortcut) for an application with Visual C++ 6.0 MFC? Pin
Anonymous16-Aug-02 11:12
Anonymous16-Aug-02 11:12 
AnswerRe: Can we put an Icon (Shortcut) for an application with Visual C++ 6.0 MFC? Pin
Ken Mazaika16-Aug-02 14:54
Ken Mazaika16-Aug-02 14:54 
GeneralNeed Advice on learning MFC. Pin
Raskolnikov16-Aug-02 10:55
Raskolnikov16-Aug-02 10:55 
GeneralRe: Need Advice on learning MFC. Pin
Michael Dunn16-Aug-02 11:17
sitebuilderMichael Dunn16-Aug-02 11:17 
GeneralRe: Need Advice on learning MFC. Pin
Raskolnikov16-Aug-02 12:09
Raskolnikov16-Aug-02 12:09 
GeneralRe: Need Advice on learning MFC. Pin
Christian Graus16-Aug-02 13:21
protectorChristian Graus16-Aug-02 13:21 
GeneralRe: Need Advice on learning MFC. Pin
Ernest Laurentin16-Aug-02 19:02
Ernest Laurentin16-Aug-02 19:02 

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.