本文介绍了扩展windows资源管理器右键菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有困难的时候搞清楚为什么这并不在我的电脑上工作。我读过这篇文章并试了一下,它为一个未知的文件类型,但是知道如.BMP它不会 - 我也删下的.bmp其他键 - 没有帮助。我在HKEY_CLASSES_ROOT.bmp和HKEY_CURRENT_USER \\软件\\微软\\的Windows \\ CurrentVersion \\ Explorer中\\ FileExts.bmp试过这种
我需要实现这个在我的程序,因此对某些文件类型,如BMP自定义上下文菜单项。
顺便说一句。我试过ContextEdit(一个免费程序) - 也没有工作 - 任何想法?也许事情不是令人耳目一新(我试着重新启动 - 并未进行任何更改)?

I'm having hard times figuring out why this doesn't work on my computer. I've read this article http://msdn.microsoft.com/en-us/library/bb776820.aspx and tried it, and it works for an unknown file type, but for know such as .bmp it doesn't - I've also deleted other keys under .bmp - didn't help. I've tried this in HKEY_CLASSES_ROOT.bmp and in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.bmpI need to implement this in my program so it has custom context menu items on some file types like bmp.btw. I've tried ContextEdit (a freeware program) - also didn't work - any ideas? Maybe something not refreshing (I've tried to reboot - didn't make any changes)?

编辑:
一个更新 - 如果我去下设置默认程序和Windows照片查看器由于某种原因,我不能将其禁用某些文件类型,如.JPG,.BMP,.GIF。真奇怪...

edit:One update - if I go under Set Default Programs and Windows Photo Viewer for some reason I can't disable it for some file types like .jpg, .bmp, .gif. That's strange...

编辑没有。 2:
现在它开始工作,我已经确定了问题 - 即使重新启动计算机后,文件关联并没有刷新。之后我相关的txt文件,以不同的编辑器我的.bmp菜单,图标和默认的程序已更改。所以,现在的主要问题是 - 我怎么手动使用C#刷新文件关联

edit no. 2:now it started working and I have determined the problem - the file associations didn't refresh even after restarting my computer. After I had associated a txt file to a different editor my .bmp menus, icon and default program have changed. So the main question now is - how do I manually refresh file associations using C#?

推荐答案

我想我已经找到了这一个解决方案,它是这样 - 定义:

I think I've found a solution for this one, and it goes like this - define:

    [DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);

    const uint SHCNF_IDLIST = 0x0;
    const uint SHCNE_ASSOCCHANGED = 0x08000000;

然后在需要的时候做您的关联code的东西,后执行:

Then do your code stuff with associations when needed, and after it execute:

    SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);

此外,如果提到的注册表键不起作用尝试:

Also if mentioned registry keys don't work try:

    HKEY_CLASSES_ROOT\SystemFileAssociations\extension\Shell\yourcommand

这篇关于扩展windows资源管理器右键菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:03