C/C++相关备忘
Microsoft VC/C++
类型 | 含义 |
---|---|
LPCTSTR | 表示const字符串,L表示long,P表示pointer,C表示const, T表示_T(win32中有一个_T宏,unicode表示w,ansi表示), 根据系统是否使用unicode编码通过typedef定义 |
HBRUSH | HBRUSH表示指向一个 包含一个int型的结构体的 指针 通过宏DECLARE_HANDLE(HBRUSH);定义 展开为#define DECLARE_HANDLE(name) struct name##__ {int unused;}; typedef struct name##__ *name 即定义typedef struct HBRUSH__ * HBRUSH,HBRUSH__为包含一个int型数据的结构体 |
LRESULT | LRESULT表示long类型; typedef LONG_PTR LRESULT; typedef _W64 long LONG_PTR, *PLONG_PTR; The _W64 annotation is a note to the Miscrosoft compiler that when compiling for a 64-bit target, the variable should be 64 bits wide instead of the usual 32, since on 64-bit platforms, pointers are 64 bits, but unsigned ints are usually still 32 bits. This ensures that sizeof(UINT_PTR) >= sizeof(void*) for all target platforms. _W64用于提示Microsoft编译器,当编译64位目标时,该变量需要是64位的,而不是常规的32位 |
__stdcall | 该关键字修饰的函数表示调用的参数从右到左由堆栈传递, 堆栈由被调用者在函数返回前清理 __fastcall表示前面的参数先由ecx,edx寄存器传递 主要见于Microsoft Visual C/C++, GNU C/C++使用另一种修饰方式 atrribute\__((stdcall)) |
CALLBACK | 根据不同的宏定义不同的函数参数传递方式,如#define CALLBACK __stdcall |
HWND | 与HBRUSH定义相同 |
WPARAM | unsigned int 类型 typedef UINT_PTR WPARAM; typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; |
LPARAM | long类型 typedef LONG_PTR LPARAM; typedef _W64 long LONG_PTR, *PLONG_PTR; |