???关于winApi的sendmessage问题 我在网页上按了一个选中一段文字,按了一个键后,用sendmessage如何获取这段文字,发送到我得textbox,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 JAVASCRIPT:textbox.value=document.select()不知道是不是document.select document.selection.createRange().text; <input type=button value=弹出你选中的文字 onclick="alert(document.selection.createRange().text)"> 不是阿,我是winform的应用程序,主要是在挂上鼠标,键盘之后,用鼠标选中一段文字,按了指定建后,将网页上选中的文字送入我一个string变量 刚刚写了一个 //using SHDocVw; 需要添加引用 COM:MicroSoft Internet Control //using mshtml; 需要添加引用 COM:MicroSoft HTML Object Libary //using System.Runtime.InteropServices; // 调用:textBox1.Text=GetSelectedIEtext(); [DllImport("user32", EntryPoint="FindWindow")] public static extern int FindWindowA(string lpClassName, string lpWindowName); /// <summary> /// 获取网页鼠标选择文本内容,只支持IE /// </summary> /// <returns></returns> public static string GetSelectedIEtext() { int ieHwnd=FindWindowA("IEFrame",null); IShellWindows sw=new ShellWindowsClass(); string res=null; for (int i=sw.Count-1;i>=0;i--) { try { SHDocVw.IWebBrowser2 ib=sw.Item(i) as SHDocVw.IWebBrowser2; if(((SHDocVw.IWebBrowser2)sw.Item(i)).HWND==ieHwnd) { mshtml.IHTMLTxtRange txt=((HTMLDocumentClass)ib.Document).selection.createRange() as IHTMLTxtRange; res=txt.text; break; } } catch { res=null; } } return res; } c# Bad IL format protected 问题? 100分求助 access 连接数据库问题 字符串加密和解密函数 十六进制数的字符串怎么转成整型 求助 发布刚开发的软件,求加密方法。 帮忙排除插入Access表的一个记录引起的错误,急!在线等? 如何在web中实现报表打印.. 能不能判断出来一个字符是不是由shift+其他一个字符按出来的? 请问发布程序时如何实现在目标服务器上自动建立IIS站点
不知道是不是document.select
//using mshtml; 需要添加引用 COM:MicroSoft HTML Object Libary
//using System.Runtime.InteropServices; // 调用:textBox1.Text=GetSelectedIEtext(); [DllImport("user32", EntryPoint="FindWindow")]
public static extern int FindWindowA(string lpClassName, string lpWindowName); /// <summary>
/// 获取网页鼠标选择文本内容,只支持IE
/// </summary>
/// <returns></returns>
public static string GetSelectedIEtext()
{
int ieHwnd=FindWindowA("IEFrame",null);
IShellWindows sw=new ShellWindowsClass();
string res=null;
for (int i=sw.Count-1;i>=0;i--)
{
try
{
SHDocVw.IWebBrowser2 ib=sw.Item(i) as SHDocVw.IWebBrowser2;
if(((SHDocVw.IWebBrowser2)sw.Item(i)).HWND==ieHwnd)
{
mshtml.IHTMLTxtRange txt=((HTMLDocumentClass)ib.Document).selection.createRange() as IHTMLTxtRange;
res=txt.text;
break;
}
}
catch
{
res=null;
}
}
return res;
}