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 :------------
CSingleDocTempl ate * pDocTemplate;
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME,
RUNTIME_CLASS(C OtengoDoc),
RUNTIME_CLASS(C MainFrame),
RUNTIME_CLASS(C OtengoView)); //Base Class of COtengoView is CListView
if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView)); //Base Class of CNewMsgView is CFormView
if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate);
------------: For New Window code :------------
CSingleDocTempl ate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView));
CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocum ent( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame ( pDoc, pFrame ); // <--
Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitl e( pDoc );
if( ! pDoc->OnNewDocumen t( ) )
{
pFrame->DestroyWindo w( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateF rame( 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 (!_AfxCheckDial ogTemplate(m_lp szTemplateName, 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 5956
"Neo" <mo******@hotma il.com> wrote in message
news:uc******** ******@TK2MSFTN GP04.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.publi c.vc.mfc.docvie w
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 :------------ CSingleDocTempl ate * pDocTemplate;
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME,
RUNTIME_CLASS(C OtengoDoc),
RUNTIME_CLASS(C MainFrame),
RUNTIME_CLASS(C OtengoView)); //Base Class of COtengoView is CListView if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView)); //Base Class of CNewMsgView is CFormView if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate); ------------: For New Window code :------------ CSingleDocTempl ate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView)); CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocum ent( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame ( pDoc, pFrame ); // <-- Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitl e( pDoc );
if( ! pDoc->OnNewDocumen t( ) )
{
pFrame->DestroyWindo w( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateF rame( 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 (!_AfxCheckDial ogTemplate(m_lp szTemplateName, 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.microso ft.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******@fruit fruit.comwrote in message
news:uc******** ******@TK2MSFTN GP04.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 :------------
CSingleDocTempl ate * pDocTemplate;
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME,
RUNTIME_CLASS(C OtengoDoc),
RUNTIME_CLASS(C MainFrame),
RUNTIME_CLASS(C OtengoView)); //Base Class of COtengoView is
CListView
if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate); //Registered Main Window
pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView)); //Base Class of CNewMsgView is
CFormView
if (!pDocTemplate)
return FALSE;
AddDocTemplate( pDocTemplate);
------------: For New Window code :------------
CSingleDocTempl ate * m_pDocTemplate;
m_pDocTemplate = new CSingleDocTempl ate(
IDR_MAINFRAME1,
RUNTIME_CLASS(C NewMsgDoc),
RUNTIME_CLASS(C NewMsgFrm),
RUNTIME_CLASS(C NewMsgView));
CDocument * pDoc = NULL;
CFrameWnd * pFrame = NULL;
pDoc = m_pDocTemplate->CreateNewDocum ent( );
if( pDoc != NULL )
{
pFrame = m_pDocTemplate->CreateNewFrame ( pDoc, pFrame ); // <--
Exception comes
if( pFrame != NULL )
{
m_pDocTemplate->SetDefaultTitl e( pDoc );
if( ! pDoc->OnNewDocumen t( ) )
{
pFrame->DestroyWindo w( );
pFrame = NULL;
}
else
{
m_pDocTemplate->InitialUpdateF rame( 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 (!_AfxCheckDial ogTemplate(m_lp szTemplateName, 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.microso ft.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 the
original page the mouse cursor is a Hour glass shape!
my code:
I use DIV tag
<DIV id ="printThis">
<%
|
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 with the above solution is the back/forward buttons and
all the other browser options. Because of this, I am trying to get
the following solution to work:
<a href="#" onclick="popUp('./pdf.do?parameter=01121980')"><b>pdf</b></a>
|
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 File | View is enabled for the top blured
window and disabled for the bottom.
These are the same exact windows both blured using window.blur(); How is it done?
Well to tell you the truth I'd prefer it NOT to happen. I am expecting a window.blur()...
|
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" menu if they want.
What happens to the child window after it is closed? Even
though my document manager maintains the instance of the
child and displays the name in the menu, when I try to use
the show() method or the activate() method on a...
|
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 enters childnode information. the pop up has a save button
and when the user clicks save, the data gets saved in DB. Popup also has a
close button, clicking which closes the screen..
My Problem: When i close the popup, how can i refresh the tree...
| |
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 on this new window to browse to different node(s) and if you return to the original window and try to browse to some node it synchronizes the view in the old window to the new window.
Is there a way to stop this from happening for example by...
|
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 document and
closes it with the following code:
<body onload="window.print(); window.close();">
This works correctly (or at least the way I expect it to work under MS
Internet Explorer, but it cuases Netscape to "crash"
|
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). After you close
this window and try to click on the different links they make the image
dissappear. Does anyone know what I can do to get it to work even
after I view the popup window? It seems like it loses focus or the
document model changes or...
|
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 obtained a new
1680x1050 widescreen monitor, and I would like to revisit this issue.
In VC6 I have the windows arranged in two rows. In the top row, the
"Workspace window" is on the left and the main Edit window is on the
right; the tabs for the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |