The problem here is that the structure of NMHDR has changed for x64. The idFrom field is now IntPtr:
public struct NMHDR
{
public IntPtr hwndFrom;
public IntPtr idFrom;
public int code;
}
I recently had this issue and changing it as above got it working for me.
David