Create Basic Windows Application with Visual C++ Express Edition

Even before learning full fledged Windows Programming with Visual C++, you can use your Visual C++ Express Edition to create a simple Windows Application. The quickest way to create a Windows Application with Visual C++ Express Edition is to use the Application Wizard. When creating a new project in Visual C++ Express Edition, select to create a Win 32 Project, specify the name of the project and follow onscreen prompts by just pressing the Enter Key on your keyboard.

Default Windows Application with Visual C++ Express

Default Windows Application with Visual C++ Express

In case you have followed the steps outline in the above paragraph, you should be able to see a code window with lots of C Code in it. In case you do not understand the code generated by the Visual C++ Application Wizard, do not worry as we are going to delete most of the code. Yes you can even build and run the code to create a Windows Application without understanding it. Once you have build and run the default code generated the the Application Wizard of Visual C++ Express Edition as outlined above, let’s go ahead and delete the code and leave only the code as displayed in the screenshot below.

Creating a Basic Hello World Application in Visual C++ Express Edition

Creating a Basic Hello World Application in Visual C++ Express Edition

As the above screenshot displays most of the code generated by the Application Wizard has been deleted and some changes are required to be done in order to build and run a basic Windows Application. Let’s create a simple Hello World Application as created in the C++ Hello World post. Effectively when the application is built and run, it will display a Message Box saying Hello World as we do not have a console window in this Win 32 Application. The modified code is as displayed below which displays a Hello World Message Box and will not open up a console window when launched.

Win32 Hello World Application Created with Visual C++ Express Edition

Win32 Hello World Application Created with Visual C++ Express Edition

Once you have updated your basic Win 32 Hello World Code to as displayed in the screenshot above, build your application and run it using Ctrl + F5 or simply F5. When this Sample Win 32 Hello World Application runs, it will not open up a black console window and you can even launch it from Windows Explorer just like any other Windows Application. In case you intent to copy this Win 32 Application to some other computer, just build the Release Build and then your Win 32 Application will run fine on almost any Windows Operating System.

// WindowsApplicationWithVisualC++.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "WindowsApplicationWithVisualC++.h"int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){::MessageBoxA(0,"Hello World","Tutorial at TapKaa.com",0);return 0;}

The Final Code of the Win 32 Application is as displayed above which you can use to create and run your own Windows based Application. Yes there is still lots of things to learn about C++ and the best way to learn C++ is using Console based Application. Feel free to browse through other posts providing sample code and tutorial for learning C++ using Microsoft Visual C++ Express Edition.