Click to See Complete Forum and Search --> : Please Answer This Code Gurus.


Fed007
March 29th, 1999, 05:25 PM
How do I call up a CFormview dialog resource?


My App is a SDI with Form View, I have used all the space I want to and now I need a new Form view ( empty ) to start putting more controls on. So I Insert a new dialog in my resouces as a formview dialog and then base the class on CFormView.


I know how to call up a dialog "boz" with DoModal but what do I do to call up my new form?

Allen
March 29th, 1999, 06:27 PM
You can add your form view to your App's doctemplate in InitInstence(). For example:

CMyApp::InitInstance()

{

// .......

pDocTemplate = new CSingleDocTemplate(

IDR_MAINFRAME,

RUNTIME_CLASS(CMyDoc),

RUNTIME_CLASS(CMainFrame), // main SDI frame window

RUNTIME_CLASS(CMyFormView)); // your formview class

AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands, DDE, file open

CCommandLineInfo cmdInfo;

ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line

if (!ProcessShellCommand(cmdInfo))

return FALSE;

// The one and only window has been initialized, so show and update it.

m_pMainWnd->ShowWindow(SW_SHOW);

m_pMainWnd->UpdateWindow();

return TRUE;

}

Normally, the cmdInfo.m_nShellCommand is "FileNew". So, your app will create a new form view for you at start up.

Hope this will help. Good luck.


Allen