Originally posted by: Dami�n Paz
This little program just caused a general fault error. It has problems when showing the dialogs.
ReplyOriginally posted by: Jianping Wu
at CViewWin::OnMouseMove to delete the pen.
Anyway, this is a great and extremely useful article.
ReplyOriginally posted by: virgil
Interesting and useful as I'm adding ActiveX controls to my win32 programs now.
ReplyOriginally posted by: Ahmed
This is the best article. it is better than whole chapters I have read from other books.
ReplyOriginally posted by: Kent Kapitan
1. Use Recipe 1 for the Basic Window App
2. Create a dialog resource with a popup style, dialog frame border, title bar, and system menu (just like MFC). Call it IDD_FORMVIEW and make it visible.
3. In place of CWindowImpl<CMyWindow> use CDialogImpl<CMyDlgWin>
4. Inside the Message Map macro place the following handlers:
COMMAND_ID_HANDLER(IDOK, OnOK)
5. use these basic implementations:
LRESULT CDlgWin::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CDlgWin::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
void OnFinalMessage(HWND /*hWnd*/)
7. add enum { IDD = IDD_FORMVIEW } to the CMyDlgWin header.
8. Finally, in WinMain replace
with
-thats it. For an excellent accompaniment to Andrew's article, see Chapter 9 of ATL Internals by Brent Rector and Chris Sells.
Here is a recipe for a dialog-based app (ala MFC FormView) using Andrew's article.
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
{
CenterWindow();
return 0;
}
LRESULT CDlgWin::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
EndDialog(IDOK);
return 0;
}
{
EndDialog(wID);
return 0;
}
6. In place of OnDestroy, use
{
::PostQuitMessage(0);
}
CMyWindow wnd;
wnd.Create(NULL,CWindow::rcDefault, _T("Hello"),
WS_OVERLAPPEDWINDOW|WS_VISIBLE);
CMyDlgWin dlg;
dlg.DoModal();
Originally posted by: Kent Kapitan
Andrew:
Thank you so much for an outstanding article. Would you consider a followup with a simple recipe for creating an ATL dialog-based app ?
ReplyOriginally posted by: Ram
Hi
How can I embedd a PropertySheet, instead of a simple dialog frame, so that I can put propertypages.
ReplyOriginally posted by: Ann-Marie Ratcliffe
I write a lot of DirectX based applications both for business and pleasure (the pleasure side comes out of two games projects I'm working on, one with a friend, and the other all my own work [and yes, its taken over 2 years, and is almost near completion]).
If its a mimimal amount of DirectX I use either VB or MFC, if its more indepth, like my game projects, I automatically turn to pure Win32 API. I hate the unnecessary baggage I get with MFC for what is not a 'normal' MFC application (plus the fact it's single-object-inheritance is a real pain), but on the other hand, writing in pure Win32 API leads you down the road of mixing classes for your own work with C style sections where you work directly with Win32 API. Admittedly I came from a Borland/Inprise background before they screwed it up, and OWL was incredibly well thought-out. I've written a basic C++ framework of my own which I use for new projects, but its not perfect (I have to ask someone about a few problems I've had with using a static AppManager class as the heart of my app, but thats for another posting).
Based on your article, I can see huge potential for retaining a proper C++ class/template environment for development, without getting MFC's 'Monkey on my back'. After this article, I intend to grab some time to experiment with the idea.
Keep up the good work. Maybe you already plan a DirectX section in this series of articles, but if not, I'll work on one.
Yours,
Ann-Marie Ratcliffe
Originally posted by: Anuj
CMyWindow w;
I have a ATL project and created a BUTTON on a simple dialog based control. When I create a window by clicking on it, the window display for 2-5 second and then IE(6.0) become shut down automatically. Please tell me where is the problem ?
w.Create(this->m_hWnd, CWindow::rcDefault, _T ("Hello"),WS_OVERLAPPEDWINDOW|WS_VISIBLE );
Originally posted by: David
Here! Here! to the other comments. When will the next article you mention be available?