How to show system menu of a file in C#

泄露秘密 提交于 2019-12-13 12:19:19

问题


I need to show system menu of a file in my application. This menu same as the image.

And, I also want to add a my menu element to this menu.

How can I do ?

Thanks


回答1:


What you're looking for is called a shell context menu. To display such a menu in your application, you'll have to call the Windows API. This is not at all easy, but fortunately for you some other people have taken a stab at it.

The C# File Browser on CodeProject has a shell context menu, which is also described in that article.

Then Andreas Johansson extracted the shell context menu code from that project and uploaded it as a separate ZIP file, which you can download here.

I have no idea how to use it, or even if it works. That's left as an exercise for the reader. But there is a lot you can learn from this if you dig into the code.



来源:https://stackoverflow.com/questions/20183811/how-to-show-system-menu-of-a-file-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!