Windows Programming
Although there are indeed differences between Windows CE and other versions of Windows, it should not be exaggerated. Compile a Windows CE ApplicationProgramWrite Windows applications.
There are the same message loops, the same windows, and in most cases, the same resources and controls. The difference does not cover up the same place. The Hungarian naming method is one of the important similarities.
Hungarian naming method
Since Charles Petzold wrote the book windows programming, most Windows programs have adopted the Hungarian naming method, which is a traditional and good naming method. This programming style was invented by Charles Simonyi many years ago at Microsoft. It represents the type of a variable with a prefix of 1 to 2 letters for each variable in the program. For example, the string array named name should be named szname, And the prefix SZ indicates that the variable type is a string with 0 Terminator. The value of the Hungarian naming method is that it greatly improves the readability of the source program. For other programmers Code You should not repeat the variable declaration to determine the type of the variable. Table 1-1 lists the typical Hungarian prefixes of variables.
Table 1-1 variable's Hungarian prefix
Variable type Hungary prefix
Integer I or N
Word (16-bit) W or S
Double Word (32-bit unsigned) DW
Long (32-Bit Signed) L
Char C
String SZ
Pointer P
Long pointer lp
Handle H
Window handle hwnd
Struct size CB
You can see some traces of early windows. LP or long pointer. In INTEL 16-bit programming mode, the pointer is divided into two short pointers (16-bit offset) and long pointers (additional offset segments ). Other prefixes consist of abbreviations of types. For example, the brush handle is usually HBR. A prefix can be a combination, just like lpsz, which indicates a long pointer ending with 0. Most windows APIs use Hungary notation to name their domains. This naming method is used throughout this book. I encourage you to use this naming method in your program.