将 EM_STREAMOUT 与 c# 和 RichEditBox 一起使用的示例
我试图使用 WM_GETTEXT 从 RichEdit 字段获取文本,但遇到了一些问题,所以我找到了 EM_STREAMOUT,这尤其适用于 RichEdit。我找到了这段代码并玩了 稍微用了一下,但我无法让它们工作:
delegate uint EditStreamCallback(IntPtr dwCookie, IntPtr pbBuff, int cb, out int pcb);
struct EDITSTREAM
{
public IntPtr dwCookie;
public uint dwError;
public EditStreamCallback pfnCallback;
}
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(HandleRef hwnd, uint msg, uint wParam, ref EDITSTREAM lParam);
也许有人有一个在 C# 中使用它的工作示例?
谢谢大卫
i trying to get a text from a RichEdit field with WM_GETTEXT, but i run into some problems, so I found EM_STREAMOUT, this is especially for RichEdit. I found this code and played
a little bit with it, but i can't get them to work:
delegate uint EditStreamCallback(IntPtr dwCookie, IntPtr pbBuff, int cb, out int pcb);
struct EDITSTREAM
{
public IntPtr dwCookie;
public uint dwError;
public EditStreamCallback pfnCallback;
}
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(HandleRef hwnd, uint msg, uint wParam, ref EDITSTREAM lParam);
maybe someone have a working example of using this in c#?
thx david
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请检查下面的示例是否适合您:
以下是您如何调用它:
在我的测试 richedit 上,这将返回以下字符串:
这有帮助,问候
Pls, check if an example below would work for you:
here's how you can call this:
on my test richedit this returns following string:
hope this helps, regards