Is MFC all or nothing?

Started by
16 comments, last by Promit 22 years, 2 months ago
I want to use certain MFC classes, but a lot of MFC really sux for a game. Can I do this, or will I need to come up with another solution? People are saying that only MFC apps can use MFC utility classes...i was hoping thats not true.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
MFC: Not necessarily all or nothing, but complex to integrate with "vanilla" Win32.

I wanna work for Microsoft!
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
...details?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Why don''t you code your own utility classes?

Oli


All the best problems start with C

.:: K o s m o s E n g i n e ::.
MFC generally requires you to include the afxwin.h header, but afxwin.h doesn''t get along too well with the usual Win32 headers. You can generally use any MFC classes you want, but be sure to call AfxWinInit() and use the /GX and /MT compilation flags.

What parts of MFC are you specifically interested in?

I wanna work for Microsoft!
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
Mostly CString and CFile...
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
MS claims CString can be used by including only afx.h and not making your project an MFC project. They lie. As soon as you include "afx.h", you get undefined symbols (some of the thread functions). If you can figure out how to do it, please let me know. I''m not ashamed to say that I think CString is actually better than std::string (because at my heart I''m still a sprintf guy, and that''s what CString::Format does).

As far as CFile goes, that involves an entire hierarchy, I believe, so you may have a hard time getting that in with the rest of MFC.

If those are the only classes you want, and you don''t want MFC, you could use std::fstream and std::string instead. They may not be as familiar to you, but they''ll get the job done.
quote:Original post by Stoffel
I''m not ashamed to say that I think CString is actually better than std::string


The two classes are the results of very different thinking in design terms. CString was designed in a world devoid of template techniques, which means it lacks the genericity and extensibility of the std::string class.

Basically, it looks to me like MS just dumped all the functionality they could into the CString class, giving a rather fat public interface. std::string, on the other hand, takes an entirely different approach - one of integration with the STL.

Since a lot of the functionality contained within CString is parelleled in the STL through algorithms and other classes, std::string is able to deal with a smaller set of responsibilities. I know which design I prefer.

--
The Dilbert Principle: People are idiots.

Use std::string and iostream. Problem solved.


Premature optimizations can only slow down your project even more.
神はサイコロを振らない!
If you''re looking for a non-MFC CString class, CodeProject has a section with a couple, I think: http://www.codeproject.com/string/

This topic is closed to new replies.

Advertisement