Home

Introduction to Microsoft Visual C++

   

The Microsoft Visual C++ Environment

 

Overview of Programming

 

C++ is a computer language that is used to create applications. C++ has its origin in its parent language named C. Actually, both C and C++ are mostly used as a foundation for computer programming and they are available on various types of computers. After you have studied these languages, you can then use a more productive environment to create fully-functional or graphical applications.

Unfortunatly, it is not really easy to create graphical applications. Instead, a better approach is to study the language first. Although C and C++ are different languages, they have some similarities. In our lessons, we will study both languages but as one. Based on this, we will use the following conventions:

  • C: When we write only C, we will refer to an issue that is used in C only but not necessarily in C++
  • C: When we write only C++, we will refer to an issue that is used in C++ only but not necessarily in C
  • C/C++: When we write C/C++, we will refer to an issue that either both C and C++ share or that can be done in either language

Introduction to Microsoft Visual C++

One of the environments you can use to study C and/or C++ is Microsoft Visual C++. Microsoft Visual C++ is available two options. Microsoft Visual Studio 2010 is a multi-language commercial environment that supports programming in C++ and many other languages (C#, Visual Basic, and F#). It includes Microsoft Visual C++ made for C and C++. To make it easy to learn C++ programming, Microsoft created Microsoft Visual C++ 2010 Express. This is a full-functional programming environment that supports both C and C++ (it also supports another child of the C language, called C++/CLI). It is free. You can use either Microsoft Visual Studio 2010 or Microsoft Visual C++ 2010 Express to create C and C++ applications. To follow our lessons, we will use either.

Microsoft Visual Studio 2010 is a commercial application. If you want to use it, you must purchase (or you can use a trial version). Microsoft Visual C++ 2010 Express is a free application. If you want to use it, you must download it from the Microsoft web site. Once you get to the site, look for and click the Visual Studio Express link. Then locate and click the Microsoft Visual C++ 2010 Express. After acquiring the software, you must install it to be able to lanuch it.

Starting Microsoft Visual C++ Express

To launch Microsoft Visual C++ 2010 Express, you can click Start -> (All) Programs -> Microsoft Visual Studio 2010 Express -> Microsoft Visual C++ 2010 Express:

Microsoft Visual C++ 2010 Express

To launch Microsoft Visual Studio 2010, you can click Start -> (All) Programs -> Microsoft Visual Studio 2010.

The Microsoft Visual Studio Interface

 
 

The Main Menu

The top section of Microsoft Visual Studio displays the main menu divided in categories such as File or Edit. The main menu is used like the menu of a normal application.

The Toolbars

Under the main menu, there is a toolbar. Normally, when the studio is launched, it displays the Standard toolbar as its default. Some additional toolbars will display in response to an action from you. Still, you can display other toolbars if you want. To do this:

  • On the main menu, click View -> Toolbars and click the toolbar of your choice
  • Right-click the main menu or any toolbar. In the that appears, click the desired toolbar

Toolbars

Toolbars are used the same way they are in other applications.

Microsoft Visual Studio's menus and toolbars can be customized. You can customize a menu category on the main menu by adding a menu item to it. You can customize a toolbar by adding a button to it. To start, right-click anything on the main menu or on any toolbar and click Customize... For example, imagine you want to add an item named Start Without Debugging to the left side of the Start button:

The position where the button will be added

To do this:

  1. Right-click the main menu or a toolbar and click Customize
  2. On the Customize dialog box, click the Commands tab
  3. Click the Toolbars radio button
  4. In the Toolbars combo box, select the toolbar that will host the button. For our example, that would be Standard
  5. In the Controls list, click the button that will come after the new button. For our example, that would be Start / Continue:
     

    Customize

  6. Click Add Command...
  7.  In the Categories list of the Add Command dialog box, select the category that has the button you want. For our example, that would be Debug
  8.  In the Commands list, click the desired button or menu item. For our example, that would be Start Without Debugging

    Add Command

  9. After making the selection, click OK

    Customize

  10. On the Customize dialog box, click Close:

The position where the button has been added

In the same way, you can customize any toolbar and any menu category.

The Start Page

 

The Start Page is the main body of Microsoft Visual Studio or Microsoft Visual C++ Express when it has been launched. It starts on top with a tab labeled Start Page. The main body of Microsoft Visual C++ Express displays Microsoft Visual C++ 2010 Express. The left section shows two labels: New Project... and Open Project... When some projects have been previously created or used, their names appear under Open Project... When you work on a project, the Start Page is usually in the background but it is represented by a tab. At any time, to display the Start Page:

  • You can click the Start Page label in the top section of the Code Editor
  • On the main menu, you can click View -> Start Page

Showing and Closing a Window

 

When you start or open a project, the studio makes some windows available. These are the most regularly used windows. If you think that one of them is not regularly used in your types of assignments, you can remove it from the screen. To hide a window, you can click its Close button Close.

All of the windows you can use are listed in the View menu. Therefore, if a window is not displaying, you can click View on the main menu and click a window of your choice.

Auto Hiding a Window

 

When working on a project, you will use a set of windows that each accomplishes a specific purpose. Some windows are represented by an icon but hide the rest of the body. To display such a window, you can position the mouse on it. This would expand the window:

Expanding a Window

If you expand a window, it would display a title bar with three buttons. One of the button is called Auto Hide:

Auto Hide

If you expand a window but find out you don't need it any more, you can just move the mouse away. The window would return to its previous state. Based on this functionality, if you are working with a window and move the mouse away, it would retract. If you need it again, you would have to reopen it using the same technique. If you are going to work with a certain window for a while, you can keep it open even if you move the mouse away. To do this, you can click the Auto Hide button. If clicked, the Auto Hide button changes from pointing left to pointing down:

Auto-Hide

By default, the studio installs some windows to the left and some others to the right of the screen. You can change this arrangement if you want. To do this, expand a window, then click its title bar and start dragging. While you are dragging, to assist you with a new position, the studio displays five boxes:

Dragging

Docking a Window to a Side of the Studio

 

To position a window on one side of the studio, drag its title bar to the box that represents that side. When you get to a side, a transparent blue rectangle would be drawn to indicate the possible position. Drop the window to either the most left guiding box to position it to the left of the screen, or to the most right guiding box to position it to the right of the screen. Here is an example:

Docking

or

Docking

To position a window to the top or the bottom side of the studio, drag its title bar to either the most top guiding box to position it to the top of the studio or to the most bottom guiding box to position it to the bottom of the studio. Here is an example:

Docking

 
 
 
 

Docking a Window Above or Below Another

 

To make two windows share an area, you can position one above or below an existing window. Of course, you must first have a window as reference. Then, drag the second window to the existing window. Drop it in the top or the bottom guiding box of the middle big box.

This

Docking

Becomes

Docking

Floating Windows

 

Most of the windows you will use are positioned on one side of the screen. If you want, you can have a window that stays on top of other windows but is not "glued" to one side. Such a window is said to float. To float a window, drag its title bar and release it somewhere in the middle of the screen but not on a guiding box.

When a window is floating, it displays a Maximize button Maximize on the title bar. If you click this button, the window occupies the whole interface of Microsoft Visual Studio. In the same way, if you double-click the title bar, the window gets maximized.

If a window is currently floating and you want to dock it, right-click its title bar and click Dock:

Dock

If a window is currently docked and you want to float it, right-click its title bar and click Float.

Coupling Windows

 

You can make two or more windows share one side of the screen or to share an area. To do this, first expand and dock the window that you will use as the base (or reference). Then, drag the title bar of the window that will share the area to its target until the bottom part of the base window shows a highlighted and a non-highlighted area:

Coupling

Then release the mouse:

Coupling

To remove a window that shares an area, drag its tab away:

Coupling

To position a window to the left or the right of an existing window, first drag the second window to where the existing window is. Then click the left (or the right, depending on the side you want) guiding box of the central multiple-box.

This

Positioning

becomes this

Positioning

 In the same way, you can make two or more windows share the same area.

Tabbed Windows

You can make a window display its tab in the top section of the Code Editor and share the area with it. There are two ways yon do it:

  • You can drag a window and drop it on the tab of the Start Page.

This

Tabbed Window

becomes this

Tabbed Window

If a window is already represented with a tab on top of the Code Editor, you can drag the second window and drop it to the left or of the right tab of the existing window.

  • You can right-click Dock as Tabbed Document
 
 
   
 

Home Copyright © 2010 FunctionX, Inc. Next