进程的使用
发布日期:2021-05-08 22:16:37 浏览次数:23 分类:精选文章

本文共 1229 字,大约阅读时间需要 4 分钟。

在这里插入图片描述

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WinFrmProcess{       public partial class mainFrm : Form    {           public mainFrm()        {               InitializeComponent();        }        ///         /// 打开所有进程        ///         ///         ///         private void button1_Click(object sender, EventArgs e)        {               var allProcess = Process.GetProcesses();            foreach (var item in allProcess)            {                   Console.WriteLine(item.ProcessName+"||"+item.Id);            }        }        ///         /// 使用进程打开程序        ///         ///         ///         private void button2_Click(object sender, EventArgs e)        {               //记事本            // Process.Start("notepad","kkk.txt");            //ie浏览器            // Process.Start("iexplore.exe","www.baidu.com");            //chrome浏览器            //Process.Start("chrome.exe", "www.baidu.com");            Process.Start(@"E:\练习\Asp.net学习\winform窗体之间的传值\Mainconsole\bin\Debug\Mainconsole.exe", "实打实大使馆  saww   76989876");        }    }}

运行效果:

1.打开所有进程:

在这里插入图片描述

2.打开程序:

在这里插入图片描述

上一篇:数据库中优化lock
下一篇:layui分页的使用

发表评论

最新留言

很好
[***.229.124.182]2025年03月30日 05时54分24秒