New Data Types

Other identifiers used in HELLOWIN.C are new data types, also defined in WINDOWS.H. The ones used in the program are:

Data Type Meaning

FAR same as far
PASCAL same as pascal
WORD unsigned integer (16 bits)
DWORD unsigned long integer (32 bits)
LONG signed long integer (32 bits)
LPSTR far (or long) pointer to a character string

These are fairly self-explanatory. The people who originally developed Windows thought that it would someday be ported to other microprocessors. These new data types were defined to ease the porting of Windows applications to other architectures. Rather than use machine-specific data sizes (such as the size of C integer), the new data types were devised to keep programs consistent regardless of the processor on which they run.

Of course, Windows will probably never be ported to other architectures, but the Windows functions are still defined using these new data types, and Windows programmers continue to use them.

HELLOWIN also uses four data structures (which I'll discuss later in this chapter) defined in WINDOWS.H:

Structure Meaning

MSG The message structure
WNDCLASS The window class structure
PAINTSTRUCT The paint structure
RECT The rectangle structure

The first two data structures are used in WinMain to define two structures named msg and wndclass. The second two are used in WndProc to define two structures named ps and rect.