Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.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# 谷歌浏览器选定文本_C#_C++_Winapi_Google Chrome - Fatal编程技术网

C# 谷歌浏览器选定文本

C# 谷歌浏览器选定文本,c#,c++,winapi,google-chrome,C#,C++,Winapi,Google Chrome,我正在尝试使用我的C#应用程序从浏览器(如opera、firefox等)获取选定的文本。 我尝试了SendKeys.Send(“^c”),然后从剪贴板读取所选值。该方法适用于ie和Firefox,但不适用于Google Chrome 我如何从Google Chrome中获取所选文本,以及为什么SendKeys.Send(“^c”)不起作用?不确定这会有什么帮助,但这家伙有一个Chrome扩展,我相信它可以做到这一点,加上它的开放源代码来检查它。对不起,如果没有帮助的话。 Chrome在不同的进程

我正在尝试使用我的C#应用程序从浏览器(如opera、firefox等)获取选定的文本。 我尝试了SendKeys.Send(“^c”),然后从剪贴板读取所选值。该方法适用于ie和Firefox,但不适用于Google Chrome


我如何从Google Chrome中获取所选文本,以及为什么SendKeys.Send(“^c”)不起作用?

不确定这会有什么帮助,但这家伙有一个Chrome扩展,我相信它可以做到这一点,加上它的开放源代码来检查它。对不起,如果没有帮助的话。

Chrome在不同的进程中处理选项卡,这可能是您的问题。gf是对的,请记住至少有2个Chrome进程正在运行。您必须找出哪个chrome.exe进程引用了您尝试执行命令的窗口。试着用单进程运行chrome,看看它是否有效(不建议继续运行)嗨,谢谢你的回复,我不认为单独进程中的选项卡是我的问题,因为我有要复制所选内容的页面的句柄,而且我尝试了PostMessage方法,但运气不好。下面是使用的方法。私有const uint VK_CONTROL=0x11;私人建筑VK_C=0x43;[DllImport(“user32.dll”,SetLastError=true)]静态外部bool PostMessage(int-hwnd、uint-Msg、int-wParam、int-lParam);PostMessage(googleChromePageHandle,VK_控件,(int)VK_C,0);