我想让我的超级简单程序将自己复制到启动文件夹,无论os是w7 / w8 / w10我已经完成的是用这个更改宣言权限:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
但我发现只有在VB中用C#编码才有帮助。
这是我的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WMPLib;
namespace Hello
{
public partial class Form1 : Form
{
WindowsMediaPlayer player = new WindowsMediaPlayer();
public Form1()
{
InitializeComponent();
player.URL = "hello.wav";
}
private void Form1_Load(object sender, EventArgs e)
{
Hide();
ShowInTaskbar = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
string saobshtenie = "kp";
string zaglavie = "zdr";
MessageBox.Show(saobshtenie, zaglavie, MessageBoxButtons.OK);
player.controls.play();
}
}
}