Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 带有EM_FINDWORDBREAK问题的SendMessage_C#_Api - Fatal编程技术网

C# 带有EM_FINDWORDBREAK问题的SendMessage

C# 带有EM_FINDWORDBREAK问题的SendMessage,c#,api,C#,Api,我尝试将SendMessage与EM_FINDWORDBREAK一起使用 我已经得到鼠标>>位置的位置 问题是SendMessage函数始终返回0 [DllImport("User32.dll", EntryPoint = "SendMessage")] public static extern int SendMessage(IntPtr hWnd, uint uMsg, int wParam, int lParam); int star= SendMessage(hHa

我尝试将SendMessage与EM_FINDWORDBREAK一起使用 我已经得到鼠标>>位置的位置

问题是SendMessage函数始终返回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); 

尝试使用SetLastError=true导入,然后使用Marshal.GetLastWin32Error。如果您的签名正确,也可以访问pinvoke.net。

使用以下方法:

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

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

因为后者只适用于32位系统。(另外,
EntryPoint=“SendMessage”
部分是多余的。)

我把这一行放在Int32 lastError2=Marshal.GetLastWin32Error()中;int star=SendMessage后(hHandle,EM_FINDWORDBREAK,(int)WB_RIGHT,pos);但也重复了不止一种方法来搞砸,我们看不到常数。不幸的是,在64位操作系统上无法触发PinvokeStackDistancement警告。很好,+1。我使用win7 32位。我尝试了这个函数,但遇到了同样的问题。在我阅读了链接后,问题变得很难。我本来想在鼠标下阅读文本,但主题很难,我是一个编程新手。对不起,我的英语