【发布时间】:2013-08-06 03:30:43
【问题描述】:
我在Form1中有这个按钮点击代码:
private void DriverVerifier_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you Sure you want to Launch the Driver Verifier. Click Yes to Confirm and No to continue", "WinForm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
}
else
{
ProcessRun.Processing(Environment.SystemDirectory, "verifier.exe", "", false, "");
}
}
这将运行 Windows 7 和 8 以及其他版本附带的驱动程序验证管理器程序。
在某些 Windows 版本中,当驱动程序验证程序管理器在表单后面运行时,您无法将其置于前面。
我的问题是,是否有任何方法可以强制这个过程在前面?
这是我的类 ProcessRun 的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
namespace Diagnostic_Tool_Blue_Screen
{
static class ProcessRun
{
public static void Processing(string WorkingDirectory, string FileName, string Arguments, bool StandardOutput, string OutputFileName)
{
Process proc = new Process();
proc.EnableRaisingEvents = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = StandardOutput;
proc.StartInfo.FileName = FileName;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WorkingDirectory = WorkingDirectory;
proc.StartInfo.Arguments = Arguments;
proc.Start();
if (StandardOutput == true)
{
string output = proc.StandardOutput.ReadToEnd();
DumpOutput(WorkingDirectory + "\\" + OutputFileName, output);
}
proc.WaitForExit();
proc.Close();
}
private static void DumpOutput(string filename, string output)
{
StreamWriter w = new StreamWriter(filename);
w.Write(output);
w.Close();
}
}
}
这是程序在后台窗体后面时的样子:
这是有问题的用户写的描述问题的内容:
发现了一个错误,但是,使用 Windows 8 和 Windows 8.1,尚未使用 7 进行测试:驱动程序验证器是非常无用的添加,当您单击它打开时(底部的红色/棕色按钮),该工具的主要窗口拒绝移动、最小化或关闭,保持焦点,因此无法看到 Driver Verifier 窗口,因为它仍然在工具窗口下(见屏幕截图)。
这只是较大显示器和多显示器系统的一个小问题,因为驱动程序验证程序可以移到一旁以便完全看到,但在较小的单显示器系统上,它会使该工具中的整个驱动程序验证程序无用。
【问题讨论】: