zoukankan      html  css  js  c++  java
  • 编程实现改变win7主题

    一  : 解析问题

    1. Windows 7 主题在:%windir%ResourcesThemes  :

     

    2: 我们通过shell 命令  (这个是msdn中提到的)

    rundll32.exe %SystemRoot%system32shell32.dll,Control_RunDLL %SystemRoot%system32desk.cpl desk,@Themes /Action:OpenTheme /file:" %SystemRoot%ResourcesThemesarchitecture.theme"

    3: 写代码  

    [csharp] view plaincopy
    1. using System;  
    2. using System.Collections.Generic;  
    3. using System.ComponentModel;  
    4. using System.Data;  
    5. using System.Drawing;  
    6. using System.Linq;  
    7. using System.Text;  
    8. using System.Windows.Forms;  
    9. using System.IO;  
    10. using System.Threading;  
    11. using System.Diagnostics;  
    12.   
    13. namespace win7改变主题  
    14. {  
    15.     public partial class Form1 : Form  
    16.     {  
    17.         public Form1()  
    18.         {  
    19.             InitializeComponent();  
    20.             string sPath = Environment.GetEnvironmentVariable("windir");//获取系统变量 windir(windows)  
    21.             DirectoryInfo directoryInfo = new DirectoryInfo(sPath + @"ResourcesThemes");  
    22.             foreach (FileInfo i in directoryInfo.GetFiles("*.theme"))  
    23.            {  
    24.                comboBox1.Items.Add(i.FullName);  
    25.            }  
    26.         }  
    27.   
    28.         private void button1_Click(object sender, EventArgs e)  
    29.         {  
    30.             if (comboBox1.SelectedIndex == -1)  
    31.             {  
    32.                 return;  
    33.             }  
    34.             string sFile = comboBox1.SelectedItem.ToString();  
    35.             string sCmd = string.Format(@"  
    36. rundll32.exe %SystemRoot%system32shell32.dll,Control_RunDLL %SystemRoot%system32desk.cpl desk,@Themes /Action:OpenTheme /file:""{0}""", sFile); //cmd命令  
    37.             Process cmd = new Process();  
    38.             cmd.StartInfo.FileName = "cmd";  
    39.             cmd.StartInfo.RedirectStandardInput = true;  
    40.             cmd.StartInfo.RedirectStandardOutput = true;  
    41.             cmd.StartInfo.CreateNoWindow = true;  
    42.             cmd.StartInfo.UseShellExecute = false;  
    43.             cmd.Start();  
    44.             cmd.StandardInput.WriteLine(sCmd);  
    45.             cmd.StandardInput.Flush();  
    46.             cmd.StandardInput.Close();  
    47.             cmd.Close();  
    48.             cmd.Dispose();  
    49.         }  
    50.     }  
    51. }  

    二 执行程序  如图:

     

    三 : 程序源代码 下载:

    http://download.csdn.net/detail/qq283868910/3866000

  • 相关阅读:
    Jenkins和Postman 集成,使用Allure 输出测试报告
    Jenkins 中使用VSTest.console 进行单元测试,使用Allure 输出测试报告
    如果网页中有ShawdowDOM ,如何使用 Selenium Web Driver 进行操作
    postman 不能打开
    chrome DEvTools 使用
    使用selenium 连接到一个已经打开的浏览器
    如何查看电脑开关机时间
    Task.Wait() 和 await Task 的区别
    已经过了1/3的2020
    Laravel7 配置jwt ,并处理 Unauthorized 错误
  • 原文地址:https://www.cnblogs.com/rr163/p/3994091.html
Copyright © 2011-2022 走看看