Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Promit

Is MFC all or nothing?

This topic is 6138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!