Visual C.NET 2005 Compiler Part II


Visual C++.NET 2005 Compiler Part II

In Visual C++ .NET Compiler Part I an empty C++ project was selected. In the first example in these notes, instead of selecting an empty project, we will leave that check box blank. Start Microsoft Visual Studio .NET using what ever means is on your computer. When you do, you should see a screen similar to the following (except for the projects listed):

image from book

Next click on File on the menu bar and then click on the menu option New and then select the Project option. What you should see is like the following:

image from book

The New Project dialog box appears and looks like the following:

image from book

On the left of the screen in the Project Types section of the dialog box, click on Win32 under the Visual C++ option. In the Templates section on the right, click on the Win32 Console Project. In the Name box type the word: test4 For the Location, select some location of your choosing. After you have completed these steps, click the OK button.

What should appear next is the Win32 Applications Wizard dialog box like the following:

image from book

Click on the Applications Settings option. Notice at the top of the dialog box that Windows application, Console application, DLL and Static library projects are the options. The default is Console Application. This time a non-empty project will be created by not clicking the Empty project option under Additional options as was done in the previous discussion.

image from book

After making these selections, click the Finish button. What you will see will be like the following:

image from book

In the Solution Explorer, double click the program: test4.cpp. Notice that the code is different from the previous examples. In particular instead of main( ) as in the previous Console program, there is the function: _tmain( ). Move your cursor to the menu bar and click: Build/Build Solution followed by Debug/Start Without Debugging. The program will compile and execute. Since there were no additional instructions, the screen will be blank. What could be done is to type in additional commands to get the program to display something on the screen. The purpose of this example is to show you what would happen if you did not select an empty project. What was done, was to create by default a Managed C++ Console program. Click File/Close Solution to begin the next example.

Next click on File on the menu bar and then click on the menu option New/Project. The New Project dialog box appears and looks like the following:

image from book

Again select Visual C++ followed by selecting Win32 in the Project Types window in the Templates window select Win32 Console Application. For the name of the project enter test3 and place the project in whatever folder you would like. Now click on the OK button. Next should appear the Win32 Applications Wizard dialog like the following:

image from book

By default the project is a Console application. Click the Applications Settings. When you do, you will see a screen like the following:

image from book

This time select the Windows application option then click the Finish button at the bottom of the dialog box.

When you click the Finish button, you should see a dialog box like the following (in the Solution Explorer you may have to double click test3.cpp to get the full screen):

image from book

Take notice that the Windows C++ program looks different from both of the Console C++ programs previously viewed. Observe that there are a number of additional files listed in the Solution Explorer that were not there for either of the Console programs.

Scroll further down into test3.cpp until you see the following:

image from book

 int APIENTRY _tWinMain(HINSTANCE hInstance,                       HINSTANCE hPrevInstance,                       LPTSTR lpCmdLine,                       int nCmdShow) 

image from book

Notice that the entry point into the Windows program begins with the function _tWinMain( ) rather than main( ) or _tmain() that you saw in the Console programs. Scroll further into the code and notice the differences between this program and the examples in the notes.

Compile and run the program. When you do, you should see a window appear that is the program which was created automatically. This program is a Managed C++ Windows program.




Intermediate Business Programming with C++
Intermediate Business Programming with C++
ISBN: 738453099
EAN: N/A
Year: 2007
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net