By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

How to use a MFC's Class in Console?

P: n/a
Hi!Nice to see you!
I hava a problem.
How to use a MFC's Class in Console?For example I want to use CString
in a win32 console program.What should I do?Sorry for my poor English.

Mar 9 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 9, 2:01 pm, "dolphin" <jdxyw2...@gmail.comwrote:
Hi!Nice to see you!
I hava a problem.
How to use a MFC's Class in Console?For example I want to use CString
in a win32 console program.What should I do?Sorry for my poor English.
It's possible to use CString in non-mfc programs.
You all need to include atlstr.h in your source file. It will work
fine.
#include <atlstr.h>

Mar 9 '07 #2

P: n/a
On Mar 9, 2:01 pm, "dolphin" <jdxyw2...@gmail.comwrote:
Hi!Nice to see you!
I hava a problem.
How to use a MFC's Class in Console?For example I want to use CString
in a win32 console program.What should I do?Sorry for my poor English.
My previous answer was based on Visual C++ 7.1 onwards.

In Visual C++ 6.0

You have to
* Include 'afx.h' in one of your main headers
* Open the menu 'Project -Settings'. On the 'General' register
of the settings dialog box choose 'Use MFC in a Shared DLL' or 'Use
MFC in a Static Library' from the drop down box called 'Microsoft
Foundation Classes'.

now you can use CString in your application. But it's adviced to use
std::string or std::wstring instead of CString in Pure C++
applications. else your code will not be portable.

Mar 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.