Solved

custom main frame

Posted on 1997-06-03
2
208 Views
Last Modified: 2010-04-10
Using:
** VC++ 4.0 std. ed.   with Win95
**My experience: new to C++ and the object oriented concept
  so please be specific and complete in your answer.
** My app:
          MDI  with an ODBC database with file support.

Normally, when this application starts up, the main frame (with standard menu and tool bar, etc.) appears with a child frame for displaying the components of the database.

but.......in my app.....

I want the main frame to have have NO MENU or TOOL BAR (nothing!, except maybe the close button ("X"), and a title bar). And instead of displaying the childframe with the database fields (controls), I want to first display a box (dialog) with 3-d buttons which will be the menu choices (it will take the place of  the standard menu). Each of these buttons will call the various tables of the database or other duties to be performed.

As I said above I'm new (and confused by this MFC), so tell me how to code and/or (what to cut out of the standard generated code) to make this happen.

Thanx, Pete
0
Comment
Question by:petlin
2 Comments
 
LVL 4

Accepted Solution

by:
AVaulin earned 100 total points
ID: 1163817
You must refuse from document orientation to create main frame without menu and toolbar. BTW cut all code in CYourApp::InitInstance from AddDocTemplate to return TRUE and insert code like this:

CString str = AfxRegisterWndClass( CS_HREDRAW|CS_VREDRAW, LoadStandardCursor(IDC_ARROW), CBrush(RGB(255,255,255)), LoadIcon(IDR_MAINFRAME) );
CRect r;
r.left = r.top = 0; r.right = 640; r.bottom = 480;
m_pMainWnd = new CMainFrame;
((CMainFrame*)m_pMainWnd)->Create( str, "Window Name", WS_VISIBLE|WS_BORDER|WS_CAPTION, r );

To show dialog before showing main frame you must
1) create dialog resource with resource editor
2) create CYourDialog class with ClassWizard help
3) insert before this code CYourDialog::DoModal member like this:

CYourDialog().DoModal();

Good luck.
0
 

Author Comment

by:petlin
ID: 1163818
I'm not clear on the following:
you say:
"You must refuse from document orientation..." refuse?
do you mean when using appwizard to create app.? There's no menu option at this point.

also, point #3)
"insert this code CYourDialog::...",  insert where?

Thanx again,

0

Featured Post

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.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

828 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