0

I know how to use CFrameWnd::Create to create a frame based application without inserting resources from the resource file, just like below:

#include <afxwin.h>

class MyFrame : public CFrameWnd
{
public:
    MyFrame()
    {
        Create(NULL,_T("Title"));
    }
};

class MyApp : public CWinApp
{
public:
    BOOL InitInstance()
    {
        CFrameWnd *Frame = new MyFrame;
        m_pMainWnd = Frame;
        Frame->ShowWindow(SW_SHOW);

        return true;
    }
} a_app;

I know I have to create a dialog based application by inserting dialog resource from the resource file. But is it possible to use CDialog::Create to create a dialog based application without inserting dialog resource from the resource file? (like above)

Banana Code
  • 759
  • 1
  • 12
  • 28
  • 3
    You can use `DLGTEMPLATE` and `CDialog::CreateIndirect`. This would be relatively simple to make a blank dialog box, then use `CButton::Create` etc. to add buttons. But what's wrong with the nice code you have above? – Barmak Shemirani Oct 28 '16 at 07:48
  • 1
    You can define an empty dialog template and use it for all your dialogs. After you add your control. – alangab Oct 28 '16 at 11:24

0 Answers0