Jump to content
Fórum Script Brasil
  • 0

Executar Thread dentro de um form


Kelvin Batista

Question

private void LogControl_Load(object sender, EventArgs e)
        {
            Thread trd = new Thread(new ThreadStart(this.ListarProcessos));
            trd.IsBackground = true;
            trd.Start();
            
        }

        public void ListarProcessos()
        {
            try
            {
                

                while(true)
                {
                   
                    // Get all client processes.
                    Process[] ProcessKilled = Process.GetProcessesByName("HideTools");
                  
                    foreach (Process ScanProcess in Process.GetProcesses())
                    {
                        // For every word in the blacklist.
                        foreach (string Word in this.ProcessWordBlacklist)
                        {
                            // Check for word in process name.
                            if (ScanProcess.ProcessName.ToLower().Contains(Word.ToLower()))
                            {
                                // If found, kill all neuz processes and the cheat process.
                                foreach (Process ProcessKill in ProcessKilled)
                                {
                                    listBox1.Items.Add(listaDadosProcesso(ProcessKill));
                                    ProcessKill.Kill();
                                }
                                listBox1.Items.Add(listaDadosProcesso(ScanProcess));
                                ScanProcess.Kill();
                                break;
                            }
                        }
                        
                    }
                    Thread.Sleep(1);
                }
                
            }
            catch { }
        }
       

        public string listaDadosProcesso(Process process)
        {
            string proc ="Processo Detectado: " + process.ProcessName.ToString();
            return proc;
        }

como podem ver tentei fazer esse loop mais por algum motivo não fica em loop essa verificação alguém poderia me ajudar ? Eu vim do C++ e ainda não consigo manipular threads com tanta facilidades em C#

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...