Archived

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

doctorsixstring

Win32 and MFC?

Recommended Posts

I''m writing a small install program. It basically just copies some files to the hard drive, and has a few dialog boxes as an interface. I want to allow the user to select a root directory to install to, using a tree control. However, this seems like it will be extremely difficult to do with the Win32 API. It seems like it wouldn''t be too hard in MFC, but I have never really looked at MFC much. My question is: Can I a MFC objects to my Win32 program without creating an "MFC project"?

Share this post


Link to post
Share on other sites
Unforuntately, things like CTreeList and CTreeView are dependant on the whole MFC framework. It is much easier to inlude straight Win32 into the MFC framework then it is to include MFC into a Win32 framework. If its a simple install program, you might be better off tackling MFC using the wizard to create a Dialog App and look at imbedding a CTreeCtrl into it, or look on www.codeguru.com or www.codeproject.com for a TreeCtrl demo and use that as your basis for your project, ultimately calling into win32 functions in your own class or C module.

Just my opinion, but then I have done a lot of MFC and feel comfortable there. Others prefer Win32 straight-up, and are very good at using it for the UI elements. I''m too lazy to figure that out

Share this post


Link to post
Share on other sites
Everything those new project options do is preset some projects settings and create a basic application template for you. You can start with an empty project, add everything yourself, and end up with nothing different from an "MFC Application".

To use MFC, you really only need to go to the General page of project settings and select the appropriate MFC version from the combobox. MFC headers will take care of linking proper libs to your project. You may, however, need to fiddle with WinMain. Depending on how exactly much of MFC you're going to use, you may be able to keep all your existing code or you may need to modify it to MFC's liking. It's hard to say more without knowing specifics. Try using whatever part of MFC you need, and if you get errors post here.

And if you don't mind reading the source and can compensate for the lack of documentation by reading docs on Win32 and MFC (which are only slightly different from the would-be proper documentation), I encourage you to try Windows Template Library, which can be seamlessly integrated into anything, including pure Win32 and heavy MFC code.

edit: and you may as well ignore this post and do what JonStelly said, except the function is called SHBrowseForFolder.

---
Come to #directxdev IRC channel on AfterNET


[edited by - niyaw on July 16, 2002 2:59:05 PM]

Share this post


Link to post
Share on other sites
Aren't the Windows Common Dialogs part of MFC? I may consider buying a book on MFC. It seems like it might be pretty useful for quickly developing windows apps. As much as I like Win32, it would be nice to write something in MFC in a few hours that would take a few days with pure Win32. I don't relish the idea of creating a tree list with icons and a full directory list of a user's computer in Win32.

Another question: What MFC books would you guys recommend? I've looked (on Amazon) at Shildt's "MFC Programming from the Ground Up", but I want to know if their are any others that would be better? Which one would you guys most recommend?

Thanks for the replies so far,
- Mike

EDIT: Oops - I just read the rest of what niyaw wrote (specifically about SHBrowseForFolder). I'm now going to give that function a try...

[edited by - doctorsixstring on July 16, 2002 3:11:30 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by doctorsixstring
Aren't the Windows Common Dialogs part of MFC?


No, they are not. Comdlgs are part of Windows User Interface, MFC just wraps them, as does WTL.

edit: cut most of this post out.

---
Come to #directxdev IRC channel on AfterNET


[edited by - niyaw on July 16, 2002 3:47:30 PM]

Share this post


Link to post
Share on other sites