static void Main(string[] args)
        {
            //Local Machine
            ProcessLocal process = new ProcessLocal();

            //Remote Machine
            //ProcessRemote process = new ProcessRemote("neal.bailey",
            //                                           "Cla$$ified",
            //                                           "BAILEYSOFT",
            //                                           "192.168.2.1");

            string processName = "notepad.exe";

            Console.WriteLine("Creating Process: " + processName);
            Console.WriteLine(process.CreateProcess(processName));
            Console.WriteLine("Setting Process Priority: Idle");
            process.SetPriority(processName, ProcessPriority.priority.IDLE);
            Console.WriteLine("Process Owner: " + process.GetProcessOwner(processName));
            Console.WriteLine("Process Owner SID: " + process.GetProcessOwnerSID(processName));

            Console.WriteLine("");

            Console.WriteLine("Properties of Process: " + processName);
            foreach (string property in process.ProcessProperties(processName))
            {
                Console.WriteLine(property);
            }

            Console.WriteLine("");
            Console.WriteLine("Killing Process: " + processName);
            process.TerminateProcess(processName);
            Console.WriteLine("Process Terminated");
            Console.ReadLine();
        }
示例#2
0
        /// <summary>
        /// Creates the native websocket instance.
        /// </summary>
        /// <param name="assemblyPath">The assembly path.</param>
        /// <param name="assemblyIdentifier">The assembly identifier.</param>
        /// <param name="websocketPort">The websocket port.</param>
        private static void createNativeWebsocketInstance(int websocketPort)
        {
            Instance = new ProcessLocal();

            port = websocketPort;

            nws = new NativeWebSocket(port);
        }
示例#3
0
        /// <summary>
        /// This method is used to retrieve the CPU usage of a particular process
        /// </summary>
        private void t_Tick(object sender, EventArgs e)
        {
            dataGridView1.Visible = true;
            int index_2 = dataGridView1.VerticalScrollingOffset;
            //keep track of the previous scroll position
            int index = dataGridView1.FirstDisplayedScrollingRowIndex;

            pl = new ProcessLocal();
            dataGridView1.DataSource = pl.ProcessMonitor();
            if (index >= 0)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = index;
            }
            updateChart();
            count++;
        }
示例#4
0
        public void GetText(IntPtr hWnd)
        {
            int length = GetWindowTextLength(hWnd);

            if (length > 0)
            {
                StringBuilder sb = new StringBuilder(length + 1);
                GetWindowText(hWnd, sb, sb.Capacity);
                if (!Regex.IsMatch(sb.ToString(), @"^MSCTFIME UI$|^Default IME$|^SysFader$|^MCI command handling window$|^GDI\+ Window$"))
                {
                    ProcessLocal pl    = new ProcessLocal();
                    string       usage = pl.returnUsageForProcess(Int32.Parse(processID.ToString()));
                    IEcpuUsage += ("PID: " + processID + Environment.NewLine + "CPU Usage: " + sb.ToString() + Environment.NewLine + usage + "%" + Environment.NewLine);
                }
            }
        }
示例#5
0
        /// <summary>
        /// This method is used to retrieve the CPU usage of a particular process
        /// </summary>
        private void getProcessInfo(object sender)
        {
            dataGridView1.SafeInvoke(d => d.Visible = true);
            //keep track of the previous scroll position
            int index = Int32.Parse(dataGridView1.FirstDisplayedScrollingRowIndex.ToString());

            pl = new ProcessLocal();
            DataTable processMonitor = new DataTable();

            processMonitor = pl.ProcessMonitor();
            dataGridView1.SafeInvoke(d => d.DataSource = processMonitor);
            if (index == -1)
            {
                dataGridView1.SafeInvoke(d => d.FirstDisplayedScrollingRowIndex = index + 1);
            }
            else
            {
                dataGridView1.SafeInvoke(d => d.FirstDisplayedScrollingRowIndex = index);
            }
            this.changeUsageValue();
            this.updateChart();
            count++;
        }
示例#6
0
 /// <summary>
 /// Constructor for HandlerParameters class which is used to initialize variables
 /// </summary>
 /// <param name="sender">WebSocket object</param>
 /// <param name="instance">IILETSNet object</param>
 /// <param name="args">Event object</param>
 public HandlerParameters(object sender, ProcessLocal instance, WebSockets.Events.MethodReceivedEventArgs args)
 {
     Args     = args;
     Instance = instance;
     Sender   = sender;
 }