获取选定的文本 [英] Get Selected Text

查看:105
本文介绍了获取选定的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的海峡编辑控件没有多余的装饰. VS 2008 C ++.是否有一种简单的方法来仅获取选定的文本以复制到剪贴板?我不想使用MFC或其他任何东西.只是普通的旧C/C ++.我知道我可以R单击并获取文本,但是我想将任务分配给仅复制所选文本的按钮.


Lamblion

I'm using a strait edit control with no frills. VS 2008 C++. Is there an easy way to get only the selected text for copy to the clipboard? I don't want to use MFC or anything. Just plain old C/C++. I know I can R-Click and get the text, but I want to assign the task to a button which copies only the selected text.


Lamblion

推荐答案

使用GetWindowText,GetWindowTextLength获取整个文本,使用EM_GETSEL获取选择范围.
或者,将WM_COPY发送到edit控件以复制文本.

Use GetWindowText, GetWindowTextLength to get the entire text, use EM_GETSEL to get bounds of selection.
Or, send WM_COPY to the edit control to copy text.


这篇关于获取选定的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆