我做了一个Form,在Form上面用两个openDialog来打开两个文件并显示路径,用其中一个文件打开另一个文件,例如千千静听的TTPlayer.exe来打开一首歌,我用加密锁将TTPlayer.exe加密以后,得到新文件Player.exe。如果没有插入加密锁,直接双击Player.exe会提示没有检测到加密锁,但是用我做的Form来打开的话,却没有提示,直接运行,加密锁没用了,我考虑到可能是缓存的问题,但是不知道如何解决,请问这是怎么回事。附上代码如下:
public Form1()
{
InitializeComponent();
} private void openButton_Click(object sender, EventArgs e)
{
System.Windows.Forms.DialogResult result = this.openFileDialog1.ShowDialog();
if (result == DialogResult.OK || result == DialogResult.Yes)
{
this.textBox1.Text = this.openFileDialog1.FileName;
}
} private void clearButton_Click(object sender, EventArgs e)
{
this.textBox1.Text = "";
} private void openPlayerButton_Click(object sender, EventArgs e)
{
System.Windows.Forms.DialogResult result1 = this.openFileDialog2.ShowDialog();
if (result1 == DialogResult.OK || result1 == DialogResult.Yes)
{
this.textBox2.Text = this.openFileDialog2.FileName;
}
} private void openFileButton_Click(object sender, EventArgs e)
{
string filename = this.openFileDialog1.FileName;
string playfilename = this.openFileDialog2.FileName;
if (filename == null || filename == "")
{
MessageBox.Show("请选择需要打开的文件", "打开错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
if (playfilename == null || playfilename == "")
{
MessageBox.Show("请选择播放器", "打开错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else
{
ProcessStartInfo start = new ProcessStartInfo(filename, playfilename);
Process.Start(start);
} }
public Form1()
{
InitializeComponent();
} private void openButton_Click(object sender, EventArgs e)
{
System.Windows.Forms.DialogResult result = this.openFileDialog1.ShowDialog();
if (result == DialogResult.OK || result == DialogResult.Yes)
{
this.textBox1.Text = this.openFileDialog1.FileName;
}
} private void clearButton_Click(object sender, EventArgs e)
{
this.textBox1.Text = "";
} private void openPlayerButton_Click(object sender, EventArgs e)
{
System.Windows.Forms.DialogResult result1 = this.openFileDialog2.ShowDialog();
if (result1 == DialogResult.OK || result1 == DialogResult.Yes)
{
this.textBox2.Text = this.openFileDialog2.FileName;
}
} private void openFileButton_Click(object sender, EventArgs e)
{
string filename = this.openFileDialog1.FileName;
string playfilename = this.openFileDialog2.FileName;
if (filename == null || filename == "")
{
MessageBox.Show("请选择需要打开的文件", "打开错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
if (playfilename == null || playfilename == "")
{
MessageBox.Show("请选择播放器", "打开错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else
{
ProcessStartInfo start = new ProcessStartInfo(filename, playfilename);
Process.Start(start);
} }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货