Tip 1 

Q:x64编译器编译提示 GWL_USERDATA 找不到,打开 WinUser.h 发现在其中,为什么?

A:需要将 GWL_USERDATA 该为 GWLP_USERDATA,GWLP_USERDATA 也在 WinUser.h中。如果提示某些宏/变量类型找不到,那么可以在同头文件中找找是不是有 “加P” 版本。

 

 

Tip2

Q:某些函数的入参类型不匹配,比如SetTimer的最后一个参数要求的函数类型中包含UINT_PTR,32位系统上可以正常编译,但是x64不行,需要设置成UINT_PTR,此类型是架构兼容的,定义见下图。

A:在必要的位置使用UINT_PTR代替UINT

​basetsd.h #if defined(_WIN64)     typedef __int64 INT_PTR, *PINT_PTR;     typedef unsigned __int64 UINT_PTR, *PUINT_PTR;     typedef __int64 LONG_PTR, *PLONG_PTR;     typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;     #define __int3264   __int64 #else     typedef _W64 int INT_PTR, *PINT_PTR;     typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;     typedef _W64 long LONG_PTR, *PLONG_PTR;     typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;     #define __int3264   __int32 #endif​