473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to use a MFC's Class in Console?

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
2 5235
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Susanne | last post by:
Hello! In have embedded python into my MFC application. It works fine using the PyRun_SimpleString method, giving it a string with some simple commands. When i am using PyRun_SimpleFile...
1
by: learningGuy | last post by:
Can someone tell me what is wrong with this simple code? I get an exception every time at the myFile.Open() line. I have included the code that I think is needed to for you to answer this below:...
3
by: Greg | last post by:
I seek to understand ATL better. When I create a Win32 Project (App or DLL) the option to add support for ATL (or MFC) is not selectable. It is only selectable for a Win32 Console App. However, it...
12
by: Rasika WIJAYARATNE | last post by:
I am new to VCPP and was wondering about the unmanaged part of it: 1. Does MFC include all the functions/functionality of the STL so it can be used standalone? 2. Is the MFC mainly used for...
3
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has...
8
by: Tony Johansson | last post by:
Hello! I just wonder what the difference is between a native win32-app and MFC. What I know is that you can use Win32 API in both cases. I think an MFC application is connected with a GUI...
4
by: Alex | last post by:
Hi, all I have an experience in programming with VS6 (Visual C++, MFC, STL), but I'm totally beginner in VS.Net, so forgive me for the stupid questions. But I'll really appreciate if somebody...
5
by: Tadeusz Jordan | last post by:
Hello. I am trying to learn MFC but here is the question for which I was unable to find the answer. Given this class definition: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { What does...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.