Hi,
We have the following piece of C# code in our application:
private IntPtr _DefaultWndProc = IntPtr.Zero;
[DllImport("user32")]
private static extern IntPtr SetWindowLongPtr(IntPtr hwnd, int index, WndProcPointer wndProcPointer);
[DllImport("user32")]
private static extern IntPtr SetWindowLongPtr(IntPtr hwnd, int index, IntPtr wndProc);
[DllImport("user32")]
private static extern IntPtr GetWindowLongPtr(IntPtr hwnd, int index);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
private static extern int CallWindowProc(IntPtr wndProc, IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
private const int GWL_WNDPROC = (-4);
private const int WM_NCDESTROY = 0x0082;
private delegate int WndProcPointer(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
protected virtual int WndProc(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam)
{
return CallWindowProc(_DefaultWndProc, hwnd, msg, wparam, lparam);
}
_DefaultWndProc is being set as follows:
_DefaultWndProc = SetWindowLongPtr(control.Handle, GWL_WNDPROC, _MyWndProc);
When we compile and execute this program for 32 bit configuration everything works fine.
However, if we set the configuration for 64 bit, the method call "CallWindowProc(_DefaultWndProc, hwnd, msg, wparam, lparam)" listed above is throwing the following exception:
System.OverflowException - {"Arithmetic operation resulted in an overflow."}
This occurs only when we move the mouse cursor over certain columns in a ListView.
Thanks!