我设计了一个应用程序,当他打开他的电脑时应该问候用户。该程序在我的电脑上运行良好,但是当我将该程序的.exe文件转移到我兄弟的电脑上时,不起作用,这意味着“它不能自动工作时,电脑启动”...我怎样才能克服这个问题??这是我的代码当电脑启动时自动运行程序
注意:程序运行良好,如果我手动执行它,但我希望它自动工作。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.IO;
namespace helloMSG
{
public partial class Form1 : Form
{
RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
public Form1()
{
InitializeComponent();
reg.SetValue("My app", Application.ExecutablePath.ToString());
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
} `
该程序是否可以在你兄弟的PC上运行?他安装了哪个版本的.Net? – 2014-10-04 08:49:37
迎接用户的程序在哪里?你有的代码似乎与阅读注册表有关! – 2014-10-04 08:52:02
该程序运行良好,如果我手动执行它,但我希望它自动工作。 – Boulis 2014-10-04 08:52:03