注册窗口注册表文件扩展名? [英] Register file extension in window registry?

查看:244
本文介绍了注册窗口注册表文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要注册窗口注册表我自己的项目延期。我搜索谷歌,至少我发现这个code,这个效果很好,但我不明白一行。什么是%L。

I want to register my own project extension in window registry. I searched on google, at least i found this code, this works well, but I don't understand one line. What is meaning of "%L".

在C#code是

string ext = ".ext";
        RegistryKey key = Registry.ClassesRoot.CreateSubKey(ext);
        MessageBox.Show(exePath);
        key.SetValue("", "My Project");
        key.Close();

        key = Registry.ClassesRoot.CreateSubKey(ext + "\\Shell\\Open\\command");
        //key = key.CreateSubKey("command");

        key.SetValue("", "\"" + Application.ExecutablePath + "\" \"%L\"");
        key.Close();

        key = Registry.ClassesRoot.CreateSubKey(ext + "\\DefaultIcon");
        key.SetValue("", Application.StartupPath + "\\icon.ico");
        key.Close();

这是混淆了我行

 key.SetValue("", "\"" + Application.ExecutablePath + "\" \"%L\"");

请解释一下,我非常感谢你提前。

Please explain, I'm very thankful to you in advance.

推荐答案

如果您的应用程序的可执行文件位于C:\\目录的\\你的Program.exe
线被转换为

If your application executable is in C:\your dir\your program.exe the line is translated to:

C:\\目录的\\你的Program.exe%L

"C:\your dir\your program.exe" "%L"

%L转换为你打开文件,所以你的程序执行具有该文件作为第一个参数

%L is translated to the file you're opening, so your program is executing having that file as the first parameter

这篇关于注册窗口注册表文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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