个人代码库の自定义后缀名
生活随笔
收集整理的這篇文章主要介紹了
个人代码库の自定义后缀名
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
using Microsoft.Win32; //操縱注冊表的必要命名空間。
namespace myMethod
{
public class CreateSuffixName
{
//使程序獲取被雙擊了的文件的路徑,用到[Command]函數,可以[獲取路徑].
/// <summary>
/// 創建自定義后綴名的方法。
/// </summary>
/// <param name="strHouZhuiMing">以".XX"格式輸入自定義后綴名</param>
/// <param name="strName">可以輸入任意English words,建議輸入公司的英文名字或軟件名字</param>
/// <param name="strShuoMingYu">對其進行解釋的說明性文字,可任意輸入。</param>
/// <param name="strIconPath">如其名,輸入顯示自定義格式文件圖標的路徑。</param>
/// <param name="strEXEpath">如其名,輸入用來打開該后綴名的程序路徑,推薦使用相對路徑。</param>
private static void myMethod_CreateSuffixName(string strHouZhuiMing,
string strName,
string strShuoMingYu,
string strIconPath,
string strEXEpath)
{
RegistryKey reg = Registry.ClassesRoot;
reg.CreateSubKey(strHouZhuiMing).SetValue("" ,strName );
reg.CreateSubKey(strName ).SetValue("" , strShuoMingYu );
reg.CreateSubKey(strName + @"\DefaultIcon").SetValue("" , strIconPath);
reg.CreateSubKey(strName + @"\shell\open\command").SetValue("" , strEXEpath + " %1");
}
}
}
namespace myMethod
{
public class CreateSuffixName
{
//使程序獲取被雙擊了的文件的路徑,用到[Command]函數,可以[獲取路徑].
/// <summary>
/// 創建自定義后綴名的方法。
/// </summary>
/// <param name="strHouZhuiMing">以".XX"格式輸入自定義后綴名</param>
/// <param name="strName">可以輸入任意English words,建議輸入公司的英文名字或軟件名字</param>
/// <param name="strShuoMingYu">對其進行解釋的說明性文字,可任意輸入。</param>
/// <param name="strIconPath">如其名,輸入顯示自定義格式文件圖標的路徑。</param>
/// <param name="strEXEpath">如其名,輸入用來打開該后綴名的程序路徑,推薦使用相對路徑。</param>
private static void myMethod_CreateSuffixName(string strHouZhuiMing,
string strName,
string strShuoMingYu,
string strIconPath,
string strEXEpath)
{
RegistryKey reg = Registry.ClassesRoot;
reg.CreateSubKey(strHouZhuiMing).SetValue("" ,strName );
reg.CreateSubKey(strName ).SetValue("" , strShuoMingYu );
reg.CreateSubKey(strName + @"\DefaultIcon").SetValue("" , strIconPath);
reg.CreateSubKey(strName + @"\shell\open\command").SetValue("" , strEXEpath + " %1");
}
}
}
?
轉載于:https://www.cnblogs.com/AsionTang/archive/2010/05/09/1885713.html
總結
以上是生活随笔為你收集整理的个人代码库の自定义后缀名的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Desktop OS Market Sh
- 下一篇: Gun N' Rose 小组分工、项目制