1. Differences between false/true and false/true:
False/true is the new keyword in the Standard C ++ language, while false/true is through # define, which is used to solveProgramIn the differences between C and C ++ environments, the following is the definition of false/true in windef. h:
# Ifndef false
# Define false 0
# Endif
# Ifndef true
# Define true 1
# Endif
That is to say, false/true is the int type, while false/true is the bool type. So they are different, but we do not feel this way in use, because C ++ will help you perform implicit conversion.
2. Differences between the bool size and the bool size:
Bool occupies 1 byte in C ++, while bool is of the int type. The size of the int type depends on the specific environment. So: false/true only occupies 1 byte, while True/false indicates that the following bool is in windef. definition in H: typedef int bool;
3. Differences between null and 0:
Let's take a look at the definition of null in windef. h:
# Ifndef null
# Ifdef _ cplusplus // This indicates that the program is compiled using C ++.
# Define null 0
# Else
# Define null (void *) 0)
# Endif
# Endif
So there is no difference between them, but a forced type conversion will be performed in C.
4. Differences between hinstance and hmodule:
Definition in windef. h:
Typedef hinstance hmodule;/* hmodules can be used in place of hinstances */
5. Callback, the essence of winapi:
Definition in windef. h:
# UNDEF far
# UNDEF near
# UNDEF Pascal
# Define far
# Define near
# If (! Defined (_ Mac) & (_ msc_ver> = 800) | defined (_ stdcall_supported ))
# Define Pascal _ stdcall
# Else
# Define Pascal
# Endif
# If defined (doswin32) | defined (_ Mac)
# Define cdecl _ cdecl
# Ifndef cdecl
# Define cdecl _ cdecl
# Endif
# Else
# Define cdecl
# Ifndef cdecl
# Define cdecl
# Endif
# Endif
# Ifdef _ Mac
# Define callback Pascal
# Define winapi cdecl
# Define winapiv cdecl
# Define apientry winapi
# Define apiprivate cdecl
# Ifdef _ 68k _
# Define Pascal _ Pascal
# Else
# Define Pascal
# Endif
# Elif (_ msc_ver >=800) | defined (_ stdcall_supported)
# Define callback _ stdcall
# Define winapi _ stdcall
# Define winapiv _ cdecl
# Define apientry winapi
# Define apiprivate _ stdcall
# Define Pascal _ stdcall
# Else
# Define callback
# Define winapi
# Define winapiv
# Define apientry winapi
# Define apiprivate
# Define Pascal
# Endif
6. Definitions of some common types:
Definition in windef. h:
Typedef uint wparam;
Typedef long lparam;
Typedef long lresult;
Typedef int;
Typedef unsigned int uint;
Typedef unsigned long DWORD;
Typedef int bool;
Typedef unsigned char byte;
Typedef unsigned short word;
Typedef float;
Typedef unsigned long ulong;
Typedef unsigned short ushort;
Typedef unsigned char uchar;
Typedef char * psz;
7. essence of common window resource types:
Definition in windef. h:
Declare_handle (Hpen );
Declare_handle (hbitmap );
Declare_handle (hbrush );
Declare_handle (HDC );
Declare_handle (hfont );
Declare_handle (hicon );
Declare_handle (hmenu );
Declare_handle (hmetafile );
Declare_handle (hinstance );
Declare_handle (hpalette );
Typedef word atom;
Typedef handle hglobal;
Typedef handle hlocal;
Typedef handle globalhandle;
Typedef handle localhandle;
Typedef hicon hcursor;/* hicons & hcursors are polymorphic */
Typedef DWORD colorref;
In Windows X. h:
# Define declare_handle32 declare_handle
Penwin. h:
# Ifndef declare_handle32
# Define declare_handle32 (name )\
Struct name ##__ {int unused ;};\
Typedef const struct name ##__ far * Name
# Endif //! Declare_handle32
6. Related preprocessing macros of the compiled versions of Platform:
| Macro |
Description |
| _ Cplusplus |
Defined for C ++ programs only. |
| _ Mfc_ver |
Defines the MFC version. defined as 0x0421 for Microsoft Foundation Class Library 4.21. Always defined. |
| _ Msc_ver |
Defines the compiler version. defined as 1200 for Microsoft Visual C ++ 6.0. Always defined. |
| _ Win32 |
Defined for applications for win32. always defined. |