开发者

SendMessage with EM_FINDWORDBREAK problem

开发者 https://www.devze.com 2023-01-31 22:32 出处:网络
i try to use SendMessage with EM_FINDWORDBREAK i have gotthe position of mouse >> pos the problemis 开发者_运维技巧 SendMessage function alwaysreturn 0

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

精彩评论

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

关注公众号