Source : ct|23.04.08
< Tutorials Computer, Multimedia, Chinese
Littles C++ programs, written in Windows version, require a number of code lines relatively important, compared with littles program written in console version.The following example make exception to this rule. To write then to compile him, i have used the free (GPL) integrated development environment Codeblocks.The integrated development environments Devcpp, or Visual Studio Express 2008 can also be free downloaded on internet and allow of course to obtain the same result.
Run Codeblocks, then choose "File/New/Project". Choose a project type "Win32 GUI".
Then choose the application type "Frame Based" (and not "Dialog Based").
By default, Codeblocks generates, in the file "main.cpp", the souce code of a Windows application .
Delete all this code and replace him by the following code.
#include <windows.h>
int APIENTRY WinMain(HINSTANCE h1, HINSTANCE h2, LPSTR l, int n)
{
MessageBox(NULL,"Bonjour!","Exemple",MB_OK);
return 0;
}
The Win32 program is now very reduced. Now it does not take more that 5 small lines of codes, of which only one is significant (Messagebox).
Compile and run the programme (Build/Build and Run). Choose the Release option (and not the Debug option), if you want a standalone program.
The programme displays a simple message box. This is yet well a Windows program and not a console program.
© http://turrier.fr (2007) |