A Simple Windows Program
This page has source to a simple windows program showing how to create a window and draw on it. It shows lines, circles, Bezier curves, and text. Read the source code comments to understand it, and modify it to learn the basics. This is not meant to be in depth, or of professional quality (use DirectX or OpenGL for much more powerful graphics!), but to show a simple app for drawing under Win32.
Instructions to make a simple windows (Win32) program using Microsoft Visual C++ 6.0
1. Start Microsoft Visual C++ 6.0
1. Under the File menu, select New....
2. On the dialog that appears, select the Projects tab
3. Highlight the Win32 Application entry, under the location edit box enter a directory, say C:\Code (this directory must exist already), and in the Project Name edit box enter SimpleWinApp. The code and related files will then be stored in the directory C:\Code\SimpleWinApp. Press OK.
4. On the next dialog box, select An Empty Project, and click Finish. On the next dialog, click OK. You now have created a project, to which you must add source code files.
5. Create a new text file: Select File, New.. again, select the Files tab, highlight text file, and name the file SimpleWinApp.cpp. Press OK. The dialog creates the file, adds it to the project, and saves it to the proper directory.
6. Type in the code here: or download the file (right click on link, and select save target as) and place it in the proper location (overwrite the file with the name SampleWinApp.cpp in your C:\Code directory).
7. Compile it. Under the Build menu, select Rebuild All
8. Run it. Under the Build menu, select Execute SimpleWinApp.exe. You should see this
9. Play around with the program - stretch and resize it. Draw on the screen with the mouse (click left button, hold, drag, release - draws lines)
That is it!