I am going to make SDI base application in MFC, which has a button for "New
Window", will show new window with different view.
How I can solve this problem? Main window view class inherited with
CListView, and New Window view class inherited with CFormView.
------------: Following windows are registered :------------
CSingleDocTemplate * pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COtengoDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(COtengoView)); //Base Class of COtengoView is CListView
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView)); //Base Class of CNewMsgView is CFormView
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
------------: For New Window code :------------
CSingleDocTemplate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView));
CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocument( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame( pDoc, pFrame ); // <--
Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitle( pDoc );
if( ! pDoc->OnNewDocument( ) )
{
pFrame->DestroyWindow( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateFrame( pFrame, pDoc, TRUE );
}
}
}
if( pFrame == NULL || pDoc == NULL )
{
delete pDoc;
AfxMessageBox( AFX_IDP_FAILED_TO_CREATE_DOC );
}
in this code, when "pFrame = m_pDocTemplate->CreateNewFrame( pDoc,
pFrame );" give exception comes on this code
File : viewform.cpp
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG
tell me, how solve this problem?
regards,
Mohammad Omer Nasir. 3 5934
"Neo" <mo******@hotmail.com> wrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl... I am going to make SDI base application in MFC, which has a button for "New Window", will show new window with different view.
If no one responds here try posting again in one of the MFC groups, perhaps
here:
microsoft.public.vc.mfc.docview
Regards,
Will I am going to make SDI base application in MFC, which has a button for "New Window", will show new window with different view. How I can solve this problem? Main window view class inherited with CListView, and New Window view class inherited with CFormView. ------------: Following windows are registered :------------ CSingleDocTemplate * pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COtengoDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(COtengoView)); //Base Class of COtengoView is CListView if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView)); //Base Class of CNewMsgView is CFormView if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate); ------------: For New Window code :------------ CSingleDocTemplate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView)); CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocument( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame( pDoc, pFrame ); // <-- Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitle( pDoc );
if( ! pDoc->OnNewDocument( ) )
{
pFrame->DestroyWindow( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateFrame( pFrame, pDoc, TRUE );
}
}
} if( pFrame == NULL || pDoc == NULL )
{
delete pDoc;
AfxMessageBox( AFX_IDP_FAILED_TO_CREATE_DOC );
} in this code, when "pFrame = m_pDocTemplate->CreateNewFrame( pDoc, pFrame );" give exception comes on this code File : viewform.cpp #ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG tell me, how solve this problem? regards,
Mohammad Omer Nasir.
In my understanding, AddDocTemplate(pDocTemplate); is used to add
document template, not for registering View class.
here is a sample for mulitple view in SDI
support.microsoft.com/support/kb/articles/q141/3/33.asp
VSWAP Demos Multiple-View Switching in SDI
thanks alot,
regards,
Mohammad Omer Nasir.
"www.fruitfruit.com" <no******@fruitfruit.comwrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl...
>
I am going to make SDI base application in MFC, which has a button for
"New
Window", will show new window with different view.
How I can solve this problem? Main window view class inherited with
CListView, and New Window view class inherited with CFormView.
------------: Following windows are registered :------------
CSingleDocTemplate * pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COtengoDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(COtengoView)); //Base Class of COtengoView is
CListView
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView)); //Base Class of CNewMsgView is
CFormView
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
------------: For New Window code :------------
CSingleDocTemplate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME1,
RUNTIME_CLASS(CNewMsgDoc),
RUNTIME_CLASS(CNewMsgFrm),
RUNTIME_CLASS(CNewMsgView));
CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocument( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame( pDoc, pFrame ); // <--
Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitle( pDoc );
if( ! pDoc->OnNewDocument( ) )
{
pFrame->DestroyWindow( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateFrame( pFrame, pDoc, TRUE );
}
}
}
if( pFrame == NULL || pDoc == NULL )
{
delete pDoc;
AfxMessageBox( AFX_IDP_FAILED_TO_CREATE_DOC );
}
in this code, when "pFrame = m_pDocTemplate->CreateNewFrame( pDoc,
pFrame );" give exception comes on this code
File : viewform.cpp
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG
tell me, how solve this problem?
regards,
Mohammad Omer Nasir.
In my understanding, AddDocTemplate(pDocTemplate); is used to add
document template, not for registering View class.
here is a sample for mulitple view in SDI
support.microsoft.com/support/kb/articles/q141/3/33.asp
VSWAP Demos Multiple-View Switching in SDI
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jawahar Rajan |
last post by:
All,
I have a printer friendly page that is opened when a user clicks a link on
my page to get the printer friendly version,
How ever when they close out the printer friendly version and return to...
|
by: Michael |
last post by:
I am trying to allow a user to view a PDF in a new window. I
currently have this working using the following:
<a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a>
The problem...
|
by: George Hester |
last post by:
http://home.nycap.rr.com/foryorisonly/site.htm
The top one is very different from the bottom one. If you do not recognize the difference
scroll the images to the right. Not that the toolbar...
|
by: Jon |
last post by:
I am writing an MDI app that uses a document manager class
to keep track of opened child windows. I want the user to
be able to close a child window, but then re-open the
window from the "Window"...
|
by: sri |
last post by:
hi All:
This is the situaton..
I have a treeview with nodes in an aspx page. The node data is coming from
DB. when i select a node and click add button, a pop up screen is ahown
where the user...
|
by: Shahbaz |
last post by:
Hi,
I am currently using UIP 2.0 in my aspx application. I have noticed while using sample store application that if during a cart task you press ctl+N to start a new browser window and then work...
|
by: stephen |
last post by:
I have created an order form that users javascript to create a new html
document when the customers clicks the "print page" button.
Once the new document has been created it then prints the...
|
by: shawn |
last post by:
I have a simple script located here which loads different images when
you click on some links. Everything works fine until you click on the
last link which opens a popup window (zoom image). ...
|
by: David Wilkinson |
last post by:
Apart from the loss of the ClassWizard for MFC work, the thing I have
disliked most about the VS2003 IDE is that I have never been able to
arrange the windows in a way that I like. I have just...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |