Reputation: 683
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.
Upvotes: 3
Views: 7532
Reputation: 69706
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();
}
Upvotes: 7