Building and Running a Windows Program

You can use the Development Environment to create programs that run under and take advantage of the features of the Windows operating system.

Windows programs are appropriate when:

You want to learn Windows programming

You already have the Windows source code for the program

The program needs the full Windows graphical interface

To familiarize yourself with the steps for creating a Windows program, use either the GENERIC project from Chapter 3 or a project of your own.

·To build and run a project as a Windows program:

1.From the Project menu, choose Open. The Open Project dialog box appears.

2.Enter a project name with a .MAK file extension and choose OK. The Edit Project dialog box appears. (See Figure 3.2 on page 25.)

3.Select a file to add to the project and choose Add, or double-click the filename. Repeat until all files are added to the project.

4.Choose OK. The project is set as the current project.

5.From the Options menu, choose Project. The Project dialog box appears. (See Figure 4.1.)

6.Select the Windows EXE Program Type button. The default compiler and linker options change to reflect the program type. See Part 2 for information about compiler and linker options.

7.From the Build Mode options, select Release.

8.Choose OK.

9.From the Project menu, choose Build. The project is automatically saved.

If no errors are reported, you can run the program. To do so, choose Go from the Run menu.

If you have used the GENERIC project from Chapter 3, you will see the Generic Sample Application screen (Figure 4.2).

Choose Exit from the File menu to quit the program and return to the Development Environment.

NOTE:

You can build Windows DLLs in the same way as Windows programs except that you select Windows DLL as the program type in the Project dialog box. For more information about DLLs, see Chapter 28 of C for Windows.