zoukankan      html  css  js  c++  java
  • C#设置自定义文件图标实现双击启动

    修改注册表,双击文件直接打开

    string strProject = "Exec";
    string p_FileTypeName =".cdb";//文件后缀
                string fileName = System.Windows.Forms.Application.ExecutablePath;// 获取启动了应用程序的可执行文件的路径及文件名
                //string startPath = System.Windows.Forms.Application.StartupPath;//获取启动了应用程序的可执行文件的路径
           //注册文件类型            
           
    Registry.ClassesRoot.CreateSubKey(p_FileTypeName).SetValue("", strProject, RegistryValueKind.String); using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(strProject)) { //设置图标 RegistryKey iconKey = key.CreateSubKey("DefaultIcon"); iconKey.SetValue("", System.Windows.Forms.Application.StartupPath + "\ooopic_1564036072.ico"); //设置默认启动程序 key.CreateSubKey(@"ShellOpenCommand").SetValue("", fileName + " "%1"", RegistryValueKind.ExpandString); }
  • 相关阅读:
    栈和队列
    数组的遍历查找
    字符串的子串
    两个字符串
    字符串的遍历
    字符串的替换
    数组和矩阵
    Django 自带的ORM增删改查
    what's the CRSF ??
    Rabbitmq -Publish_Subscribe模式- python编码实现
  • 原文地址:https://www.cnblogs.com/alannever/p/12715390.html
Copyright © 2011-2022 走看看