0
在资源管理器中双击文件正确地将文件添加到我的应用程序的最近列表中,我可以从我的应用程序上的弹出式菜单再次打开它,开始菜单。SHAddToRecentDocs不会将我的文件添加到最近的文档
我在应用程序中有一个特殊的文件管理器,所以我使用SHAddToRecentDocs将在应用程序中打开的项目添加到最近的文件中。但它不会发生,我无法找到问题所在。
下面是我在注册表了:
HKEY_CLASSES_ROOT\.abc\Content Type = application/MyApp
HKEY_CLASSES_ROOT\.abc\(Standard) = MyAppProjectFile
HKEY_CLASSES_ROOT\MyAppProjectFile\shell\open\command\(Standard) = "C:\MyApp\MyApp.exe" %1
HKEY_CLASSES_ROOT\Applications\MyApp.exe\shell\open\command\(Standard) = "C:\MyApp\MyApp.exe" %1
有下HKCR \应用程序\ MyApp.exe中没有其他按键。
就像我说的,我可以通过在资源管理器中双击它们来打开应用程序,它们会被添加到最近的文档中,并且一切都很正常。我可以从弹出的罚款打开它们。
我的SHAddToRecentDocs调用,它得到一个正确的路径,似乎没有做任何事情。最近的文档文件夹中没有链接。
这里的C#代码,我用它来运行SHAddToRecentDocs:
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
static extern void SHAddToRecentDocs(ShellAddToRecentDocsFlags flags, string file);
[Flags]
public enum ShellAddToRecentDocsFlags
{
Pidl = 0x001,
Path = 0x002,
}
/// <summary>
/// Adds the file to recent files list in windows.
/// </summary>
/// <param name="fullPath"> Name of the file. </param>
public static void AddFileToRecentFilesList(string fullPath)
{
SHAddToRecentDocs(ShellAddToRecentDocsFlags.Path, fullPath);
}