0
Error   1   'WindowsFormsApplication1.Process' does not contain a definition for 'StartInfo' and no extension method 'StartInfo' accepting a first argument of type 'WindowsFormsApplication1.Process' could be found (are you missing a using directive or an assembly reference?) 
D:\Anas Work\ANAS FOLDER\4th Semester\Introduction To operating System\Programs\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs  24  16  WindowsFormsApplication1

我的代码如下:

process p1= new process();
p1.startinfo.filename="chorome.exe";
4

2 回答 2

5

正如 Habib 在现已删除的评论中提到的那样,看起来您已经声明了自己的名为 的类Process,这把事情搞砸了。我建议无论如何都要重命名它以避免混淆,但我个人认为通过创建第一个进程ProcessStartInfo然后使用它来启动进程来开始一个新进程是最清楚的 - 而不是在现有Process对象中设置它然后调用Start

var info = new ProcessStartInfo
{
    FileName = "chrome.exe",
    ...
};
var process = Process.Start(info);

(另请注意,C# 区分大小写,因此您的示例代码在这方面也是不正确的。)

于 2013-09-11T15:33:57.337 回答
0
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.northwindtraders.com";
Process.Start(startInfo);
于 2013-09-11T15:38:32.923 回答