Showing formview
Tommi Ylikulju -- tylikul@siika.ratol.fi
Monday, January 08, 1996
I created my very first application with Visual C++ 1.51
using AppWizard. Then I used AppStudio to make a formview
and associated it with my document and frame-window
classes using a document template in CMyApp::InitInstance.
Everything worked fine.
But then I noticed that I don't need the document class at all.
I removed document initialization code and added followind code
into InitInstance to create and show framewindow:
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
My CMainFrame constructor looks like this:
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
Create(NULL, "Installer v0.01!", WS_OVERLAPPEDWINDOW,
rectDefault, NULL, MAKEINTRESOURCE(IDR_MAINFRAME));
}
It works fine, but now I don't know how to show my formview, which I have
created in AppStudio. This shouldn't be too hard,
should it? I don't have any MFC books (just Microsoft
online books and there is only info about how to create and use
formviews with document classes).
Any help appreciated.
------------------------------------------------
| Tommi Ylikulju |
| The Raahe Institute Of Computer Engineering |
| E-mail: tylikul@ratol.ratol.fi |
-------------------------------------------------
Niels Ull Jacobsen -- nuj@kruger.dk
Tuesday, January 09, 1996
[Mini-digest: 2 responses]
> I created my very first application with Visual C++ 1.51
> using AppWizard. Then I used AppStudio to make a formview
> and associated it with my document and frame-window
> classes using a document template in CMyApp::InitInstance.
> Everything worked fine.
> But then I noticed that I don't need the document class at all.
[...]
It sounds as if what you need is simply a dialog-based application.
The VC 1.5 AppWizard can't generate them, but it's quite simple:
Just rip out all the document/view/mainframe stuff from
CMyApp::InitInstance and add a
CMyDialog dlg;
dlg. DoModal();
return FALSE; // Exits the program.
Of course if you need menus and stuff, it'll be a bit more work.
It is illustrated in the tracer sample.
> Tommi Ylikulju |
--
Niels Ull Jacobsen, Kruger A/S
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger
group and should be taken as legally binding in every respect. Pigs
will grow wings and fly.
-----From: Amir Salzberg
I think you should use AddDocTamplate including a CDocument derived class.
The last parameter you use is your derivd CFormView class. You should buy
Microsoft Press's "Inside Visual c++ version 1.5" (or look for help in the
"help" section at the visual workbranch) for more help.
| Вернуться в корень Архива
|