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 299 views
299 views asked Oct 13, 2018 by avibootz
1 answer 271 views
271 views asked Oct 13, 2018 by avibootz
1 answer 355 views
1 answer 192 views
192 views asked Jun 1, 2023 by avibootz
1 answer 339 views
339 views asked Jun 30, 2019 by avibootz
1 answer 340 views
1 answer 321 views
321 views asked Oct 5, 2018 by avibootz
...