开发者

SendMessage with EM_FINDWORDBREAK problem

i try to use SendMessage with EM_FINDWORDBREAK i have got the position of mouse >> pos

the problem is 开发者_运维技巧 SendMessage function always return 0

 [DllImport("User32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(IntPtr hWnd, uint uMsg, int wParam, int lParam);

int  star= SendMessage(hHandle, EM_FINDWORDBREAK, (int)WB_RIGHT, pos); 


Use this:

 [DllImport("User32.dll", EntryPoint = "SendMessage")]
 public static extern IntPtr SendMessage(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);

Instead of:

 [DllImport("User32.dll", EntryPoint = "SendMessage")]
 public static extern int SendMessage(IntPtr hWnd, uint uMsg, int wParam, int lParam);

because the latter only works on 32-bit systems. (Also, the EntryPoint = "SendMessage" portion is redundant.)


Try the import with SetLastError = true and then Marshal.GetLastWin32Error. Also see pinvoke.net if you got the signature right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜