Thread: Dialog Boxes: Windows vs MFC stuff

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    199

    Question Dialog Boxes: Windows vs MFC stuff

    Hi there!

    I've been having all sorts of trouble compiling code that will show a dialog box recently. It appears after much searching I'm getting confused between two rather separate entities.

    If I tried to use a straightforward simple windows program (say one that just opens a small window and ends when you close it) and then added a dialog box to it, I got terrible problems when I tried to compile and sometimes even after compiling I'd hit a run time error.

    I was trying to use the method of dialog box creation that requires an existing class that implements the dialog box. The class has to descend from the base class CDialog, and then call one of its member functions. Theres functionality in Visual C++ that does some of this for you provided a class is already declared and descends from CDialog. Even adds a new function for you specifically for the button you're editing.

    However this is what caused all the trouble. Getting it to compile was very difficult and then some of the weirdest run time errors I've ever seen occurred even when it did.

    When I switched to just using the function DialogBoxW and the required parameters for it, it ran fine. When I checked Microsoft's documentation it became further apparent the methods I was trying to use fall under two umbrellas and I've been getting them mixed up.

    So my question is...what is the difference between them? I know one is MFC (Microsoft Foundation Class) orientated and the other Windows orientated but I don't get the difference.

    I'm also a bit worried that using the windows version might restrict some functionality but I might be getting a bit paranoid there.

    Thanks

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,626
    MFC is built on top of the Windows API, so anything that can be done with MFC can be done with the underlying API. I suggest using the basic API for now.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    199
    That's cleared it up very concisely. Thanks John

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing stuff into dialog boxes
    By Quantumcat in forum Windows Programming
    Replies: 1
    Last Post: 10-04-2010, 12:39 AM
  2. dialog boxes
    By pastitprogram in forum C++ Programming
    Replies: 1
    Last Post: 07-28-2008, 02:13 PM
  3. dialog boxes
    By dreadrocksean in forum C++ Programming
    Replies: 0
    Last Post: 04-10-2005, 11:28 AM
  4. Need help with dialog boxes
    By Zoalord in forum Windows Programming
    Replies: 6
    Last Post: 02-24-2002, 11:38 PM
  5. Windows Dialog Boxes
    By aresashura in forum Windows Programming
    Replies: 1
    Last Post: 12-02-2001, 04:18 PM

Tags for this Thread