两个小知识:C#如何设置开机启动时自动执行程序|C# WinForm打开超链接
2011-05-09 08:47
1081 查看
通过在Microsft.Win32命名空间的Registry可以在注册表中设置注册表项中的名称/值对的值。
在注册表的"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"中
存储应用程序名和路径可以实现程序的自启动。代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutoRun
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//设置开机启动
private void btnSet_Click(object sender, EventArgs e)
{
Microsoft.Win32.Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
, Application.ProductName, Application.StartupPath + Application.ProductName);
}
//C# WinForm打开超链接
private void Form1_Load(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("iexplore.exe", "http://revit.5d6d.com");
}
}
}
源码:http://revit.5d6d.com/thread-896-1-1.html
在注册表的"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"中
存储应用程序名和路径可以实现程序的自启动。代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutoRun
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//设置开机启动
private void btnSet_Click(object sender, EventArgs e)
{
Microsoft.Win32.Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
, Application.ProductName, Application.StartupPath + Application.ProductName);
}
//C# WinForm打开超链接
private void Form1_Load(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("iexplore.exe", "http://revit.5d6d.com");
}
}
}
源码:http://revit.5d6d.com/thread-896-1-1.html
相关文章推荐
- C#.NET Form设置/取消开机自动运行,判断程序是否已经设置成开机自动启动
- winform(c#) 开机自动启动程序
- C#.NET Form设置/取消开机自动运行,判断程序是否已经设置成开机自动启动
- win7如何添加开机启动程序(开机就自动运行打开)
- 在linux下如何设置开机自动启动程序?
- c#设置开机自动启动程序本篇文章来源于:
- C#.NET Form设置/取消开机自动运行,判断程序是否已经设置成开机自动启动(转载)
- c#设置开机自动启动程序本篇文章来源于:
- linux下如何设置开机自动启动程序
- 在linux下如何设置开机自动启动程序?
- winform(c#) 开机自动启动程序
- Winform开机自动执行程序C#版开机自动运行
- 手把手教你使用 Raspberry - 设置开机启动图片/屏蔽彩虹屏/用户自动登录/开机执行程序
- 如何设置网页打开时自动执行某个javascript程序?
- C#中如何重启系统并在开机后自动执行当前可执行程序
- 如何修改开机自动启动程序的设置!
- C#Winform程序如何发布并自动升级(图解)
- 如何让程序随开机自动启动
- C# winForm程序开机启动和托盘显示 (转http://blog.csdn.net/xinyue3054/article/details/6599508)
- C# 设置程序开机自动运行(+注册表项)