110,534
社区成员
发帖
与我相关
我的任务
分享
Process myProcess = new Process();
// Get the process start information of notepad.
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(@"E:\桌面\xlMouseLocker.exe");
// Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
myProcess.StartInfo = myProcessStartInfo;
// Create a notepad.
myProcess.Start();
System.Threading.Thread.Sleep(1000);
ProcessModule myProcessModule;
// Get all the modules associated with 'myProcess'.
ProcessModuleCollection myProcessModuleCollection = myProcess.Modules;
//为什么会拒绝访问
Console.WriteLine("File names of the modules associated "
+ "with 'notepad' are:");
// Display the 'FileName' of each of the modules.
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
myProcessModule = myProcessModuleCollection[i];
Console.WriteLine(myProcessModule.ModuleName + " : "
+ myProcessModule.FileName);
}
// Get the main module associated with 'myProcess'.
myProcessModule = myProcess.MainModule;
// Display the 'FileName' of the main module.
Console.WriteLine("The process's main module's FileName is: "
+ myProcessModule.FileName);
myProcess.CloseMainWindow();