修改全局系统菜单 [英] Modifying global system menus

查看:166
本文介绍了修改全局系统菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在C#的方式在全球范围内的菜单项添加到所有活动窗口中的所有系统菜单?也许下的最大化命令?

Is there a way in C# to globally add a menu item to all the system menus on all active windows? Perhaps under the "Maximize" command?

推荐答案

这不能用托管代码实现。这将是即使在unmanged代码非常困难。基本上你将不得不以注入代码到每一道工序,然后将物品进入本地系统菜单,并钩住主窗口过程截获WM_SYSCOMMAND消息,以便你可以让菜单项做一些事情。

This can't be done in managed code. And it would be remarkably difficult even in unmanged code. Basically you would have to inject your code into every process, and then insert items into the local system menus, and then hook the main window proc to intercept the WM_SYSCOMMAND messages so that you could make the menu items do something.

您可以写 FindWindow函数代码,将只使用添加WS_TOPMOST风格(大多数)窗口(安全许可)得到窗口处理然后 SetWindowLong函数来改变窗口的风格。

You CAN write code that will add the WS_TOPMOST style to (most) windows (security permitting) just by using FindWindow to get the window handle and then SetWindowLong to change the window style.

但你不能把UI该到其他进程的系统菜单。

But you won't be able to put the UI for this into other process's system menus.

这篇关于修改全局系统菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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