COMO FECHAR TODOS OS PROGRAMAS ABERTOS (XP)

Delphi

07/07/2003

Olá Pessoal

Como faço para listar e fechar todas as aplicacoes abertas no windows??, somente os programas, nao preciso dos processos, pois o windows continuará executando os processos padroes.

Achei essa rotina aqui no forum, mas nao consegui fazer disparar a funcao, alguem tem alguma sugestao ou pode me ajudar.

Valeu

FUNÇÃO QUE LOCALIZA OS AQRQUIVOS ABERTOS

Function EnumWindowsProc (Wnd: HWND; lb: TListbox): BOOL; stdcall;
var caption: Array [0..128] of Char;
begin
Result := True;
if IsWindowVisible(Wnd) and
((GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) or
(HWND(GetWindowLong(Wnd, GWL_HWNDPARENT)) = GetDesktopWindow))and
((GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW) = 0)
then
begin
SendMessage( Wnd, WM_GETTEXT, Sizeof(caption),integer(@caption));
lb.Items.AddObject( caption,TObject( Wnd ));
end;
end;

DISPARADOR DA FUNÇÃO

EnumWindows( @EnumWindowsProc, integer( listbox1 ));

(o erro acontece aqui no disparador, pede Variable ´Requerid´)

Abracos


Kamello

Kamello

Curtidas 0
POSTAR