我像这样使用GetWindowLong:
[DllImport("user32.dll")]
private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
但根据 MSDN 文档,我应该使用 GetWindowLongPtr 来兼容 64 位。 http://msdn.microsoft.com/en-us/library/ms633584(VS.85).aspx
GetWindowLongPtr 的 MSDN 文档说我应该这样定义它(在 C++ 中):
LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex);
我曾经使用 IntPtr 作为返回类型,但是对于 LONG_PTR 的等价物,我到底要使用什么?我还看到在 C# 中这样定义 GetWindowLong:
[DllImport("user32.dll")]
private static extern long GetWindowLong(IntPtr hWnd, int nIndex);
什么是正确的,如何确保正确的 64 位兼容性?