Ir para conteúdo
Fórum Script Brasil
  • 0

filtrar dados do taskil.exe


clm

Pergunta

olá pessoal...sou novo neste Forum e gostaria muito que me tirassem uma grande dúvida !!!!! bem ... vamos lá...estou querendo colocar num memo informaçoes puxadas de um aplicativo nativo do windows xp "TASKlist.EXE e colocar num memo quando habilitar um button.. para q nesse memo eu possa ver os processos q estao sendo usados no momento.....posteriormente com o comando taskil poder encerrar o processo q eu desejar.....será q alguém pode me ajudar???? d qualquer forma um abraço a todos.%7Boption%7Dhttp://Meus documentos :rolleyes:

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
estou querendo colocar num memo informaçoes puxadas de um aplicativo nativo do windows xp "TASKlist.EXE e colocar num memo quando habilitar um button.. para q nesse memo eu possa ver os processos q estao sendo usados no momento.....posteriormente com o comando taskil poder encerrar o processo q eu desejar

Veja este post

http://scriptbrasil.com.br/forum/index.php...st&p=487680

ou faça uma busca no forum

http://scriptbrasil.com.br/forum/index.php...hlite=processos

abraço

Link para o comentário
Compartilhar em outros sites

  • 0

não estou conseguindo entender !!!!.... Quero q num form com um memo ..chame as informaçoes do tasklist.exe quando eu precionar um button !!!! assim posso ver os processos atuais.........

Link para o comentário
Compartilhar em outros sites

  • 0
não estou conseguindo entender !!!!.... Quero q num form com um memo ..chame as informaçoes do tasklist.exe quando eu precionar um button !!!! assim posso ver os processos atuais.........

O código que te passei é justamente para fazer isso... só que ao invés de mostrar os processos em um Memo está mostrando em um Listview

With the following routines it ist simply easy to kill a running process.
  First build a form with a TListview with 3 columns and a TButton
  to refresh the running processes.
  Attach the Refreshclick-procedure to the TButton and the
  ListViewDblClick-procedure with the TListview
  The TListview shows the processes.
  With a Doubleclick on one of the processnames you can kill this running process.
  Don't forget to include TLHelp32 into your uses-clause!

  Mit der nachfolgend aufgeführten Routinen können Sie die in einer
  Windowssitzung laufenden Prozesse aufzeigen und bei Bedarf auch
  entfernen. Hierfür benötigen Sie ein Formobject, ein ListViewobject und zu-
  mindest ein ButtonObject. Verknüpfen Sie das Buttonobject mit dem BtnRefreshClick
  damit gleich beim Start des Programms alle Prozesse angezeigt werden.
  Zum löschen eines Prozesses müssen Sie eine Verknüpfung zwischen DblClick
  des Listviewobject mit der Procedure ListviewDblClick.
  Wie aus den beigefügten Routinen ersichtlich, kann auch ein einzelner Prozess
  gesucht und terminiert werden. Die hierzu erforderlichen Schritte können aus
  der Refreshroutine entnommen werden.
  Wichtig ist die Einbindung der Unit TlHelp32 !
}

interface

uses
 {...,}TLHelp32 {important !}

// Global Variables, Globale Variablen

var
  aSnapshotHandle: THandle;
  aProcessEntry32: TProcessEntry32;
  
implementation

procedure TForm1.BtnRefreshClick(Sender: TObject);
var
  i: Integer;
  bContinue: BOOL;
  NewItem: TListItem;
begin
  ListView1.Items.Clear;
  aSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  aProcessEntry32.dwSize := SizeOf(aProcessEntry32);
  bContinue := Process32First(aSnapshotHandle, aProcessEntry32);
  while Integer(bContinue) <> 0 do
  begin
    NewItem := ListView1.Items.Add;
    NewItem.Caption := ExtractFileName(aProcessEntry32.szExeFile);
    NewItem.subItems.Add(IntToHex(aProcessEntry32.th32ProcessID, 4));
    NewItem.subItems.Add(aProcessEntry32.szExeFile);
    bContinue := Process32Next(aSnapshotHandle, aProcessEntry32);
  end;
  CloseHandle(aSnapshotHandle);
end;


procedure TForm1.ListView1DblClick(Sender: TObject);
var
  Ret: BOOL;
  PrID: Integer; // processidentifier
  Ph: THandle;   // processhandle
begin
  with ListView1 do
  begin
    if MessageDlg('Do you want to Terminate "' + ItemFocused.Caption + '"?' + ^J +
                  'It''s possible the system becames instable or out of' + ^J +
                  'control......',
        mtConfirmation, [mbYes, mbNo], 0) = mrYes then
     begin
       PrID := StrToInt('$' + ItemFocused.SubItems[0]);
       Ph := OpenProcess(1, BOOL(0), PrID);
       Ret := TerminateProcess(Ph, 0);
       if Integer(Ret) = 0 then
         MessageDlg('Cannot terminate "' + ItemFocused.Caption + '"',
                     mtInformation, [mbOK], 0)
       else
         ItemFocused.Delete;
     end;
   end;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  {
    ListView1.Columns.Add;
    ListView1.Columns.Add;
    ListView1.Columns.Add;
    ListView1.ViewStyle := vsReport;
  }
  BtnRefresh.Click;
end;

abraço

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,7k
×
×
  • Criar Novo...