How to start notepad and get the open notepad process id in C#

1 Answer

0 votes
using System.Diagnostics;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Process notePad = Process.Start("notepad");

            textBox1.Text = "Notepad process Id = " + notePad.Id;
        }
    }
}




/*
 * run:
 *
 * Notepad process Id = 30908
 * 
 */

 



answered Nov 18, 2023 by avibootz

Related questions

1 answer 302 views
302 views asked Oct 13, 2018 by avibootz
1 answer 276 views
276 views asked Oct 13, 2018 by avibootz
1 answer 361 views
1 answer 197 views
197 views asked Jun 1, 2023 by avibootz
1 answer 342 views
342 views asked Jun 30, 2019 by avibootz
1 answer 342 views
1 answer 324 views
324 views asked Oct 5, 2018 by avibootz
...