C# 获取系统启动项,并添加到listbox中!!

来源:百度知道 编辑:UC知道 时间:2024/05/17 03:15:36
如题!!

先悬赏5分,可以追加分!!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

foreach (string name in GetRegistName())
{
this.label1.Text += name + ":" + GetRegistData(name) + "\r\n";
}
}

private string GetRegistData(string name)
{
string registData;
RegistryKey hkml = Registry.LocalMachine;
RegistryKey aimdir = hkml.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
registData