我設計了一個應用程序,當他打開他的電腦時應該問候用戶。該程序在我的電腦上運行良好,但是當我將該程序的.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