Fórum Duvida #209257
25/01/2004
0
Obrigado...
Alima
Curtir tópico
+ 0Posts
25/01/2004
Luisfernando
function EnumWindowsProc(Wnd : HWnd;Form : TForm1) : Boolean; Export; {$ifdef Win32} StdCall; {$endif}
var
Buffer : Array[0..99] of char;
begin
GetWindowText(Wnd,Buffer,100);
if StrLen(Buffer) <> 0 then
Form.ListBox1.Items.Add(StrPas(Buffer));
Result := True;
end;
E essa para finalizar um processo.
PostMessage(FindWindow(´Nome do processo´, nil), WM_QUIT,0,0);
Gostei + 0
25/01/2004
Fabio.hc
procedure TForm1.ButtonKillAllClick(Sender: TObject); var pTask : PTaskEntry; Task : Bool; ThisTask: THANDLE; begin GetMem (pTask, SizeOf (TTaskEntry)); pTask^.dwSize := SizeOf (TTaskEntry); Task := TaskFirst (pTask); while Task do begin if pTask^.hInst = hInstance then ThisTask := pTask^.hTask else TerminateApp (pTask^.hTask, NO_UAE_BOX); Task := TaskNext (pTask); end; TerminateApp (ThisTask, NO_UAE_BOX); end;
Eu ainda não testei.
Gostei + 0
25/01/2004
Dhiogo
Function EnumWindowsProc (Wnd: HWND; lb: TStringlist): 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.AddObject( caption,TObject( Wnd )); end; end; procedure TForm1.Button1Click(Sender: TObject); var strs:TStringlist; i:integer; hwnd:Thandle; begin strs:=tstringlist.Create; EnumWindows( @EnumWindowsProc, integer(strs)); for i := 1 to strs.Count-1 do begin hwnd:=findwindow(nil,pchar(strs.Strings[i])); if hwnd <> 0 then sendmessage(hwnd,wm_close,0,0); end; end;
Gostei + 0
25/01/2004
Alima
Gostei + 0
25/01/2004
Beppe
[]´s
Beppe
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)