GetWindowLong vs GetWindowLongPtr in C# <p>I was using GetWindowLong like this:</p> <pre><code>[DllImport("user32.dll")] private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); </code></pre> <p>But according to the MSDN docs I am supposed to be using GetWindowLongPtr to be 64bit compatible. <a href="http://msdn.microsoft.com/en-us/library/ms633584(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms633584(VS.85).aspx</a></p> <p>The MSDN docs for GetWindowLongPtr say that I should define it like this (in C++):</p> <pre><code>LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex); </code></pre> <p>I used to be using IntPtr as the return type, but what the heck would I use for an equivalent for LONG_PTR? I have also seen GetWindowLong defined as this in C#:</p> <pre><code>[DllImport("user32.dll")] private static extern long GetWindowLong(IntPtr hWnd, int nIndex); </code></pre> <p>What is right, and how can I ensure proper 64bit compatibility?</p>