0

I'm trying to build a Windows Universal App (UWP). I've downloaded the community edition of Visual Studio and started a blank app.

One of the things I want to do is to use the process class to get information about a certain process that is running.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace MyApp
{
    class MyClass
    {
        public MyClass()
        {
            var MyProcess = System.Diagnostics.Process.GetProcesses().FirstOrDefault(f => f.ProcessName == "MyProcess");
        }
    }
}

However this doesn't work. The project won't build because it can't find the process class. Does anyone know what's I'm doing wrong? Do I need to included a reference to that class?

Pattle
  • 5,983
  • 8
  • 33
  • 56
  • 2
    http://stackoverflow.com/questions/33925096/how-to-execute-process-commands-or-similar-using-a-universal-windows-platform – Nikhil Vartak Jun 21 '16 at 19:50

1 Answers1

5

You don't have access to other processes.

UWP applications (and their predecessors WinRT applications) pretty much run in a sandbox. For the sake of system stability they usually don't have access to each other. OEM and carriers have access to capability declarations in some cases that allow deeper access into the system but the general application developer does not.

Joel
  • 2,230
  • 1
  • 20
  • 28
  • Ah, that makes sense, thanks for the help. In that case what type of application do you suggest? Command line application? – Pattle Jun 21 '16 at 20:16
  • A console application should work. You can also make use of WPF apps which will have access to the same APIs. – Joel Jun 22 '16 at 01:52