Thread: Which one :MFC, Win32, Windows Forms (.Net)?

  1. #1
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Which one :MFC, Win32, Windows Forms (.Net)?

    MFC, Win32, Windows Forms (.Net):

    Okay, I've finally finished learning General C++ and want to take my knowledge of Ansi to a windows based app.

    I was looking at the MFC types and found I should be using WIN32 type, then someone tells me I should be using Windows Forms instead.
    Would someone be kind enough to tell me what the difference is between the 3 (what kind of apps are best suited for use with them) and a generalized idea of how a reference works (not too much detail is needed).

    Lol, I've created my first application under Windows Forms (.Net)
    that cleans my system for me, I'm sooooo proud lol
    Now, if I could learn to make and read a config file it would be even better!

    Rob Sitter
    <<Master at Novice>>

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> make and read a config file

    Registry baby, registry!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Differences:
    Win32 is the underlying API that is used for making windows programs. It is relatively more difficult to use than the others. It is not object oriented, just a bunch of function calls.

    MFC is a class library that is written over top of the Win32 API's. It was made to simplify the coding of windows Apps. Some people like it, others don't.

    Forms.NET is the way to code windows apps using the .NET framework. The .NET framework is just a class library that is written for all .NET languages, i.e. C#, VB.NET, managed c++, JScsript.NET. I have written GUIs in VB.NET and found it to be preferable to using MFC. But I haven't tried using it for a c++ application.

    As for writing the config file, I assume you mean the .NET config files that are xml based. I can only give a VB.NET sample (because I'm lazy) and you can try and port it to c++. Also try doing a search on google for ".NET Framework Reference" and go to microsofts doc page. There's a lot of good docs there and also quite a bit of sample code if you're willing to look for it.

    As for what a reference is, I really hope you don't mean what is a object reference in straight c++. Because if so, you should disregard everything I have told you, and go find a basic c++ book like "The c++ programming language" by Strustrep, and forget about everything else until you've finished it...

    The code:
    Code:
    Module Module1
    
        Sub Main()
            Dim col As IDictionary
            Dim x As System.Collections.DictionaryEntry
    
            System.Console.WriteLine("Trying to open config file")
    
            Try
                col = CType(GetConfig("Testing/SubTesting/Section1"),IDictionary)
            Catch ex As Exception
                System.Console.WriteLine(ex.Message)
            End Try
    
            For Each x In col
                System.Console.WriteLine("Name: {0}, Value: {1}", x.Key,x.Value)
            Next
        End Sub
    
    End Module
    The config file:
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    
    <configuration>
    	<configSections>
    		<sectionGroup name="Testing">
    			<sectionGroup name="SubTesting">
    				<section name="Section1"
    				type="System.Configuration.DictionarySectionHandler" />
    			</sectionGroup>
    		</sectionGroup>
    	</configSections>
    
    	<Testing>
    		<SubTesting>
    		<Section1>
    			<add key="Key1" value="Value1"/>
    			<add key="Key2" value="Value2"/>
    		</Section1>
    		</SubTesting>
    	</Testing>
    </configuration>
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    I used to use MFC for my Windows apps, but now I just use the Win32 API. I never really liked how MFC auto generated a lot of code, and I didn't like the Dynamic Data Exchange at all. I've never used .NET forms, so I can't comment on that.

  5. #5
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31
    Ok, so I'm going to scrap my MFC tests for a while.
    About :
    "Registry baby, registry!", I'm beginning to agree, even with the craziness of C++ it's the way to go.

    Thanks for all your replies, I did do a Google search and now have a wealth of information.

    Later,

    Rob Sitter

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I like MFC and use it commercially.

    MFC is easy and quick to develop with. I started on WIN32 in C and moved on to WIN32 C++ and then MFC.

    MFC has plenty of code developed for it and is well tested.

    If I was learning I would pick C# or another .NET framework language.

    My next job will be in C# (if my current employer does not migrate soon to C# from VB6)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    one reason i don't like MFC:

    the codes written in MFC are almost unreadable.
    it is really hard for me to find out what's going on by reading these codes.

    blow me ... ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. win32 api MDI windows
    By TheNewOne in forum Windows Programming
    Replies: 5
    Last Post: 03-20-2009, 09:11 PM
  2. IPC between MFC and .NET
    By khdani in forum Windows Programming
    Replies: 2
    Last Post: 02-26-2009, 05:39 PM
  3. Hmmm ...Win32API, MFC, .NET..which one?
    By Jubba in forum Windows Programming
    Replies: 2
    Last Post: 08-14-2003, 05:21 PM
  4. MFC or Windows API
    By aresashura in forum Windows Programming
    Replies: 7
    Last Post: 12-01-2001, 10:21 PM
  5. Docking Windows without MFC / C++ ???
    By novacain in forum Windows Programming
    Replies: 0
    Last Post: 09-17-2001, 02:44 AM