Visual C++/MFC Tutorial - Lesson 3: Visual C++ IDE and Workspaces

Lesson 3: Visual C++ IDE and Workspaces

Windows programming is tricky stuff. Don't let anyone fool you. But microsoft has blessed us with their IDE called Developer's Studio. It will handle all the compiling and linking, provides help, fills in tons of code for you, and gives you that 'visual' designing environment to make cute little dialogs.

There a few things you must learn to use to get anywhere. First and most importantly, USE THE ONLINE HELP. There are so many windows functions, you will find yourself in the help 50% of the time or more for the first few months. If you have visual c 6.0 you need the MSDN for help. Get it. If you have 4.2 or 5.0 you can use the built in help.

Next, the single most important key combination is Ctrl-W. This brings up what is called the 'Class Wizard'.  This guy will insert a bunch of code in your project for you. It handles all the code for connecting functions up to the messages windows posts.

You will also find yourself in the resource view a bit. It is used to design the dialogs. You can drop buttons on them and what not. With a couple of clicks here and there you can layout your whole application.  Then using the class wizard, you can have your project 50% finished.  All is left is to fill in the functions the class wizard made to handle the button click messages and what not.

Now you need to know how to start a new program and we can begin with the real code. Go to the File menu and select New. Then go to the 'Projects' tab and select MFC AppWizard. Type in a name for you application and press ok. The only important option for now is the first one. This is the type of application you want to build. The simplest is a 'Dialog Based'. Try them all, but try dialog based first. Just select all the defaults afterwards by pressing 'next' and 'ok'. You'll end up with a few files, but lets ignore everything.

Go to the resource view and plop some buttons and stuff on the dialog. Just play around. When you feel like it, Build the project from the 'Build' menu and run it (I always just press Ctrl-F5, it builds the project and runs it). Everything should build and run. Wa-la. Application complete and running.

One last tip on the IDE. If you right click on a menu bar, a dialog will pop up. You can select 'Customize'. This is very useful. You can build one custom menu with all the buttons you need on it by simply dragging the buttons to and from the menu bar. You can even change the menu layout (like by putting the File, New as a button on the tool bar). One really needed control is under the Build category in the customize dialog. It is the drop list used to select the active configuration. Drag that sucker up to your main toolbar and change it's size still it looks good to you. I have only one toolbar on my screen and it has the following buttons on it: save, save all, compile, build, stop build, rebuild all, set active configuration, find, find in files, show view, show output window, set break point, remove break point, tile windows, find in help.



Comments

  • Visual ide 6.0 toolbars

    Posted by Legacy on 11/19/2003 12:00am

    Originally posted by: jimbob

    There was a window at the top of the screen that I found particularly useful, but somehow it got lost or destroyed and I can't figger out how to get it back.

    When you were editing a CPP file with many functions it would display the particular function that you were in. This can be quite helpful if you inherit code - Especially if the functions are unfamiliar and quite long. When you paged or searched for text, when the cursor jumped to the "found" text, you could immediately see what function you were now in.

    Does anyone know how to get this very useful function back?

    Thanx in advance.

    Reply
  • GREAT TUTORIAL

    Posted by Legacy on 11/04/2003 12:00am

    Originally posted by: harry

    This tutorial is very good straight to the point where you need to know the basic of MFC, it also tell you what is handle does. Thank you for providing the tutorial

    Reply
  • You won my wife baby !!

    Posted by Legacy on 03/07/2003 12:00am

    Originally posted by: George Hussein

    You shake it good, damn !

    Reply
  • Hail to the king baby!

    Posted by Legacy on 01/13/2003 12:00am

    Originally posted by: Famba Tikundza

    ...But microsoft has blessed us with their IDE called Developer's Studio ???

    I've nothing against Microsoft, dont get me wrong
    but Visual Studio SUCKS.

    PD: Have you seen C++ Builder?

    Reply
  • How to chage size of the endpads in a Scroll bar

    Posted by Legacy on 12/04/2002 12:00am

    Originally posted by: Frank

    Hello

    I have made a child window scroll bar using createwindow in API function and would like to increase the size of the endpad arrows on the scroll bar for use of touch screen.

    could anyone please help me with this????


    Thank you in advance

    Reply
  • Help Me...

    Posted by Legacy on 07/09/2002 12:00am

    Originally posted by: Ivan_Wiz

    Can some one help me with MFC program or anyone have idea how to learn Visual C++ 6 in 3 days. I mean can some one teach me how to learn it.

    Reply
  • mfc

    Posted by Legacy on 05/23/2002 12:00am

    Originally posted by: Vuday Nandur

    Gread reading!!! I actually am delving more into windows stuff after 4 years.

    Reply
  • IDE stands for!

    Posted by Legacy on 05/13/2002 12:00am

    Originally posted by: VuzMan

    IDE: Integrated Development Environment

    <programming, tool> (IDE) A system for supporting the process of writing software. Such a system may include a syntax-directed editor, graphical tools for program entry, and integrated support for compiling and running the program and relating compilation errors back to the source.

    Examples include Visual C++ and Visual Basic.

    (from http://foldoc.doc.ic.ac.uk/foldoc/index.html )

    Reply
  • IDE Stands for?

    Posted by Legacy on 05/09/2002 12:00am

    Originally posted by: Brennan

    I didn't even know what IDE stands for. I would start out explaining this.

    Reply
  • It's OK

    Posted by Legacy on 04/24/2002 12:00am

    Originally posted by: Anand Agarwal

    It is cool and ok, would be read by us....

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • In this webinar, IDC featured speaker Steve Conway, Vice President of High Performance Computing, will present an update on the global x86 HPC cluster market. The presentation will include IDC's five-year forecast for the medium- to large-scale technical computing and data analysis emerging markets by systems, processors and application middleware. Cray's featured speaker, John Lee, Vice President of Cray Cluster Advanced Technology Systems, will present the new Cray® CS400™ cluster series based on …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds