IntroductionCreating a Simple window or dialog application using VC++ 6.00 or 7.00 applications Wizard is quiet easy job. But if you Examine the code you find that a lot of Stuff inside that you not familiar and for a beginner he will not get any idea how the basic stuff will work. Here i am going to explain how you can create a simple window without the help of Wizard. For simplicity I am using VC++ 6.00 Editor . Your machine must have installed the VC++ 6.0Start The VC++ Editor From your Programs And
The following window will pop up Give ‘Simple Window’ in the project name box. And click ‘win32 Application’ from the project List and click OK. You can see the next dialog as shown below
now select ‘An empty project’ and click finishNow you have created the workspace named ’simple window’ sucessfully.Next you have to add the Cpp files to the workspace. For adding the files to the workspace goto File->New and select the ‘files’ tab from the pop up dialog. select ‘C++ Source file from the tab’ and give ‘Windowsource’ in the as shown in the following figure and click OK button Now you have created all the necessaries to create a simple window. Now we can move to the coding section open the Windowsource.cpp and decalre the following header
#include “afxwin.h”
The above decalration will afxwin.h contain all the decalarations and reference for accessing the MFC classes including the CFrameWnd and CWinApp Write down the following code to the Windowsource.cpp #include “afxwin.h“ class mywindow : public CFrameWnd { public : mywindow() { Create(0,”Simple Window”); } }; class myapplication : public CWinApp { public: int InitInstance() { mywindow *p = new mywindow; p->ShowWindow(1); m_pMainWnd = p; return 1; } }; myapplication a; Before compiling you go to project->settings or click ALT + F7 .Now your code redy to compile. Now Run the project by selecting Build->Execute Simple Window.exe or use Ctrl + F5 ow you can see the window on your desktop. You can download the sample that is provided on the Top. Try Your self see it working. shine joseph . |