Solved

Creating other windows from main window

Posted on 1999-01-26
7
247 Views
Last Modified: 2010-04-02
How do you create a window(s) with its own menu items and toolbars when clicking on a menu item in the main window? Each window can perform different task and update common data. I am using VC++5.0 on NT.  
0
Comment
Question by:karamba
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:Seeker092397
ID: 1185154
What is it you are interested in exactly: the creation of a new window or handling menu item commands?


0
 

Author Comment

by:karamba
ID: 1185155
I am interested in creating a new window. I have tried making another class that is a subclass of CFrameWnd that contains its own menu and toolbar (same as main window for the moment) and I use "new" to create a new instance of the window when pressing a menu button (CMainFrame::OnNewWindow(..)). That works fine ...but I then type in Create with the default parameters and an ASSERT error occurs. I think I have to update the registry somehow but I don't know how.
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1185156
I think, you must simply use MDI interface(see windows doc). After make Active some child Window, you must change menu and ToolBar.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Accepted Solution

by:
Seeker092397 earned 100 total points
ID: 1185157
I believe that CHKBOOK sample from MSDN library will help you.
It shows how to create multiple views and frames.
The points to look at are:
CChkBookApp::InitInstance()
CChkBookApp::OpenDocumentFile()
CMainFrame::OnViewCheck()
CMainFrame::CreateOrActivateFrame()

Hope it help.
Best regards.
0
 

Author Comment

by:karamba
ID: 1185158
Thank you very much for the chkbook sample but I have a feeling that there must be no way of having another window outside the main window (i.e.looks like two application running but infact is only one). Basically, I want to create an application that looks like it is running two separate applications with its own main window (toolbars and menus) and child windows but they can communicate with the same data structure. That is because I am already joining two existing application. I would appreciate any information on this ...including a negative one!!  
0
 
LVL 1

Expert Comment

by:Seeker092397
ID: 1185159
Can you please format the text above so it all will be visible.
It is really hard to understand.
0
 

Author Comment

by:karamba
ID: 1185160
Thank you very much for the chkbook sample, it is really helpful.

However, I have a feeling that there is no way of creating another
CWinApp object in the same application (thus having two separate
Window frames e.g. for a single SDI application).

It would look like one is running two applications.

I have decided that it will be easier to do it like in the CHKBOOK
example.
       
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question