简体   繁体   中英

Sample ATL Dialog Window

Can anyone help me find an up-to-date, working ATL project which has a main window and some components in it? Please, for the love of god, don't tell me to use WTL/Qt or others. I need ATL. There's no up-to-date project about it. I just need a main window, that's all. I can figure out the rest.

Thanks in advance.

OK, for the love of god: Visual Studio 2010 C++/ATL EXE project from template + dialog window.

Source:

This is of your primary interest:

////////////////////////////////////////////////////////////
// CMainDialog

class CMainDialog :
    public CDialogImpl<CMainDialog>
{
public:
    enum { IDD = IDD_MAIN };

BEGIN_MSG_MAP(CMainDialog)
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_ID_HANDLER(IDCANCEL, OnCommand)
    COMMAND_ID_HANDLER(IDOK, OnCommand)
END_MSG_MAP()

public:
// CMainDialog

// Window Message Handlers
    LRESULT OnInitDialog(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
        ATLVERIFY(CenterWindow());
        return 0;
    }
    LRESULT OnCommand(UINT, INT nIdentifier, HWND, BOOL& bHandled)
    {
        ATLVERIFY(EndDialog(nIdentifier));
        return 0;
    }
};

and

VOID RunMessageLoop()
{
    CMainDialog Dialog;
    Dialog.DoModal();
}

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM