上下文菜单项添加到所有文本框操作系统宽 [英] Add context menu item to all text boxes operating system wide

查看:92
本文介绍了上下文菜单项添加到所有文本框操作系统宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是可能的扩展标准文件的上下文菜单中却是有办法项添加到系统范围的文本框的上下文菜单?

I know it is possible to extend the context menu of the standard file however is there a way to add items to the system-wide text box context menu?

这将是这样的新项目出现在每一个文本框,用户可以在任何地方窗口键入?

This would be so the new item appears in every text box that a user can type in anywhere in windows?

例如,以允许添加这些特征,作为查找所选文本对一个拼写检查器。

For example to allow to add such features as look up the selected text against a spell checker.

推荐答案

这是用C#在技术上是不可能的。
让想象接下来的局面。假设你已经sucessfuly写你的管理延伸,它伸出的系统中的任何文本框上下文菜单。当然,你应该处理您添加的每个新的菜单项。而实现这一目标,你应该注入托管代码到具有文本框,每个进程和替换它的 WindProc 。好吧,假设有管理的应用程序,其中已经写从您用于延伸版本不同的.NET版本的系统。因此,在这种情况下,因为只有一个版本的.NET的可能每个进程中加载​​你的扩展注入过程中有严重错误。所以没有办法写强大的管理水平低钩或外壳扩展。从 这里

This is technically impossible with C#. Lets imagine next situation. Suppose you have sucessfuly write your managed extention and it "extends" any textbox context menu in the system. And of course you should handle each new menu item you have added. and to achieve this you should inject your managed code to each process which has textbox and replace its WindProc. OK, suppose there is managed app in the system which was writen for .net version different from version you used for your extention. So in this case you would got critical error during extension injection because ONLY one version of .net could be loaded per process. SO there is no way to write robust managed low level hook or shell extension. From here:

全局钩子不是在
的.NET Framework
结果

WH_KEYBOARD_LL低级别的支持钩和
WH_MOUSE_LL低级别挂钩,你不能
落实在
的Microsoft .NET Framework全局钩子。要安装
全局钩子,钩子必须有一个本地
DLL导出在另一个
的过程,需要一个有效的,
一致函数来调用到注入本身。这种
的行为需要一个DLL导出。在
的.NET Framework不支持DLL
出口。托管代码有一个函数
指针一致的价值没有概念
,因为这些功能
指针是内置动态
代理。

Global hooks are not supported in the .NET Framework
Except for the WH_KEYBOARD_LL low-level hook and the WH_MOUSE_LL low-level hook, you cannot implement global hooks in the Microsoft .NET Framework. To install a global hook, a hook must have a native DLL export to inject itself in another process that requires a valid, consistent function to call into. This behavior requires a DLL export. The .NET Framework does not support DLL exports. Managed code has no concept of a consistent value for a function pointer because these function pointers are proxies that are built dynamically.

低层次的钩子程序被称为是安装钩子的线程上

低级钩不要求
中的挂钩过程中
DLL中实现

Low-level hook procedures are called on the thread that installed the hook. Low-level hooks do not require that the hook procedure be implemented in a DLL.

您还可以检查 这个 文章,并探讨为什么你不应该编写托管外壳扩展。

You also may check this article and explore why you shouldnt write managed shell extensions.

这篇关于上下文菜单项添加到所有文本框操作系统宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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