private static unsafe ENLINK ConvertFromENLINK64(ENLINK64 es64) { var enlink = new ENLINK(); fixed(byte *numRef = es64.contents) { enlink.nmhdr = new NMHDR(); enlink.charrange = new CHARRANGE(); enlink.nmhdr.hwndFrom = Marshal.ReadIntPtr((IntPtr)numRef); enlink.nmhdr.idFrom = Marshal.ReadIntPtr((IntPtr)(numRef + 8)); enlink.nmhdr.code = Marshal.ReadInt32((IntPtr)(numRef + 0x10)); enlink.msg = Marshal.ReadInt32((IntPtr)(numRef + 0x18)); enlink.wParam = Marshal.ReadIntPtr((IntPtr)(numRef + 0x1c)); enlink.lParam = Marshal.ReadIntPtr((IntPtr)(numRef + 0x24)); enlink.charrange.cpMin = Marshal.ReadInt32((IntPtr)(numRef + 0x2c)); enlink.charrange.cpMax = Marshal.ReadInt32((IntPtr)(numRef + 0x30)); } return(enlink); }
// ... other code ... protected override void WndProc(ref Message m) { const int WM_NOTIFY = 0x004E; const int EN_LINK = 0x070B; const int WM_SETCURSOR = 0x0020; if (m.Msg == WM_NOTIFY) { NMHDR nmhdr = (NMHDR)m.GetLParam(typeof(NMHDR)); if (nmhdr.code == EN_LINK) { ENLINK enlink = (ENLINK)m.GetLParam(typeof(ENLINK)); if (enlink.msg == WM_SETCURSOR) { // Set the result to indicate this message has been handled, // and return without calling the default window procedure. m.Result = (IntPtr)1; return; } } } base.WndProc(ref m); }
private static unsafe ENLINK ConvertFromENLINK64(ENLINK64 es64) { var enlink = new ENLINK(); fixed (byte* numRef = es64.contents) { enlink.nmhdr = new NMHDR(); enlink.charrange = new CHARRANGE(); enlink.nmhdr.hwndFrom = Marshal.ReadIntPtr((IntPtr) numRef); enlink.nmhdr.idFrom = Marshal.ReadIntPtr((IntPtr) (numRef + 8)); enlink.nmhdr.code = Marshal.ReadInt32((IntPtr) (numRef + 0x10)); enlink.msg = Marshal.ReadInt32((IntPtr) (numRef + 0x18)); enlink.wParam = Marshal.ReadIntPtr((IntPtr) (numRef + 0x1c)); enlink.lParam = Marshal.ReadIntPtr((IntPtr) (numRef + 0x24)); enlink.charrange.cpMin = Marshal.ReadInt32((IntPtr) (numRef + 0x2c)); enlink.charrange.cpMax = Marshal.ReadInt32((IntPtr) (numRef + 0x30)); } return enlink; }
private static extern void RichTextBox_EnLink(out ENLINK enlink);