“Windows (Vista) 找不到“abc.def”。 请确保您输入的名称正确,然后重试。”

发布于 2024-07-27 04:04:26 字数 388 浏览 9 评论 0原文

在 Windows Vista(仅限)中,当我双击 Windows 资源管理器中与我的应用程序关联的文件时,会显示以下消息:

“Windows 找不到“abc.def”。 确保您输入的名称正确并且 然后再试一次。

其中 abc.def 是我在资源管理器中双击的文件。 如果我的应用程序尚未运行并且文件已正确打开,则它会启动。 同样,如果我的应用程序已经在运行,则文件会正确打开。 但总是显示这个错误。

如果我使用“打开方式”并选择我的应用程序,文件将打开并且不会显示错误。

我用 Google 搜索并发现人们在使用 Word、Excel 文件等时遇到此错误的各种帖子,但没有真正的解决方案。

In Windows Vista (only) when I double click on a file in Windows Explorer that is associated with my application, the following message is displayed:

"Windows cannot find "abc.def". Make
sure you typed the name correctly and
then try again.

Where abc.def is the file I double click on in Explorer. My app starts if it isn't already running and the file does get opened correctly. Likewise if my app is already running the file is opened correctly. But this error is always displayed.

If instead I use "Open With" and select my app the file opens and no error is displayed.

I've Googled and found various posts from people getting this error with Word, Excel files etc., but no real solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

世俗缘 2024-08-03 04:04:26

我不确定,但您可以在 C# 下使用此代码将文件扩展名注册到您的应用程序。 您必须以管理员权限运行它,

 public class FileRegistrationHelper
    {
        public static void SetFileAssociation(string extension, string progID)
        {
            // Create extension subkey
            SetValue(Registry.ClassesRoot, extension, progID);

            // Create progid subkey
            string assemblyFullPath = System.Reflection.Assembly.GetExecutingAssembly().Location.Replace("/", @"\");
            StringBuilder sbShellEntry = new StringBuilder();
            sbShellEntry.AppendFormat("\"{0}\" \"%1\"", assemblyFullPath);
            SetValue(Registry.ClassesRoot, progID + @"\shell\open\command", sbShellEntry.ToString());
            StringBuilder sbDefaultIconEntry = new StringBuilder();
            sbDefaultIconEntry.AppendFormat("\"{0}\",0", assemblyFullPath);
            SetValue(Registry.ClassesRoot, progID + @"\DefaultIcon", sbDefaultIconEntry.ToString());

            // Create application subkey
            SetValue(Registry.ClassesRoot, @"Applications\" + Path.GetFileName(assemblyFullPath), "", "NoOpenWith");
        }

        private static void SetValue(RegistryKey root, string subKey, object keyValue)
        {
            SetValue(root, subKey, keyValue, null);
        }
        private static void SetValue(RegistryKey root, string subKey, object keyValue, string valueName)
        {
            bool hasSubKey = ((subKey != null) && (subKey.Length > 0));
            RegistryKey key = root;

            try
            {
                if (hasSubKey) key = root.CreateSubKey(subKey);
                key.SetValue(valueName, keyValue);
            }
            finally
            {
                if (hasSubKey && (key != null)) key.Close();
            }
        }
    }    

您可以按如下方式调用它

 string extension = ".def";
            string title = "something here";
            string extensionDescription = "some description";
            FileRegistrationHelper.SetFileAssociation(
              extension, title + "." + extensionDescription);

Am not sure, but you can use this code under C# to register a file extension to your application. you must run it with administrator privileges

 public class FileRegistrationHelper
    {
        public static void SetFileAssociation(string extension, string progID)
        {
            // Create extension subkey
            SetValue(Registry.ClassesRoot, extension, progID);

            // Create progid subkey
            string assemblyFullPath = System.Reflection.Assembly.GetExecutingAssembly().Location.Replace("/", @"\");
            StringBuilder sbShellEntry = new StringBuilder();
            sbShellEntry.AppendFormat("\"{0}\" \"%1\"", assemblyFullPath);
            SetValue(Registry.ClassesRoot, progID + @"\shell\open\command", sbShellEntry.ToString());
            StringBuilder sbDefaultIconEntry = new StringBuilder();
            sbDefaultIconEntry.AppendFormat("\"{0}\",0", assemblyFullPath);
            SetValue(Registry.ClassesRoot, progID + @"\DefaultIcon", sbDefaultIconEntry.ToString());

            // Create application subkey
            SetValue(Registry.ClassesRoot, @"Applications\" + Path.GetFileName(assemblyFullPath), "", "NoOpenWith");
        }

        private static void SetValue(RegistryKey root, string subKey, object keyValue)
        {
            SetValue(root, subKey, keyValue, null);
        }
        private static void SetValue(RegistryKey root, string subKey, object keyValue, string valueName)
        {
            bool hasSubKey = ((subKey != null) && (subKey.Length > 0));
            RegistryKey key = root;

            try
            {
                if (hasSubKey) key = root.CreateSubKey(subKey);
                key.SetValue(valueName, keyValue);
            }
            finally
            {
                if (hasSubKey && (key != null)) key.Close();
            }
        }
    }    

you call it as follows

 string extension = ".def";
            string title = "something here";
            string extensionDescription = "some description";
            FileRegistrationHelper.SetFileAssociation(
              extension, title + "." + extensionDescription);
缘字诀 2024-08-03 04:04:26

您是否尝试过将您的应用程序设置为该文件关联的默认操作? 还可以尝试在长名称和 8.3 名称(即 progra~1)之间切换。

Have you tried setting your app as the default action for that file association? Also try switching between long names and 8.3 names (i.e. progra~1).

心奴独伤 2024-08-03 04:04:26

您的应用程序需要多长时间才能启动? 我在打开一些与 Visual Studio 关联的文件时也看到了这一点。 (在我的系统上,VS 有时需要相当长的时间才能启动。)

How long does it take for your app to start? I've also seen this when opening some files that are associated with Visual Studio. (On my system, VS sometimes takes quite a bit of time to launch.)

迷你仙 2024-08-03 04:04:26

今年我遇到了类似的问题,具有相同的症状,并且我能够通过删除与软件关联的“ddeexec”注册表项来摆脱该消息(在我的例子中:HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ your software.Document \Shell\Open\ddeexec)

在此处输入图像描述

I had a similar problem this year, with the same symptoms, and I was able to get rid of the message by removing the "ddeexec" registry entry associated with the sofware (in my case : HKEY_LOCAL_MACHINE\SOFTWARE\Classes\your software.Document\Shell\Open\ddeexec)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文