Advertisement
3_2004-2005 Windows API Call/ Explanation #148293

Detecte and close any application class

This code read all running process on the system, and detect classname called 'Notepad' (Do you know what is this? :P) Then, it gets the Handle, and post a message for close the app.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Function TotalAPP(HWND : Thandle; Param : Integer): BOOL; stdcall;
var
Buff, NameOfClass : array[0..255] of char;
wintext,handle,parent,clase: string;
AppHandle: cardinal;
intExitCode: integer;
begin
  GetWindowText(HWND,PChar(LongInt(@Buff)),255);
  GetClassName(HWND,Pchar(LongInt(@NameOfClass)),255);
  WinText:=buff;
  Handle:=IntToStr(LongInt(HWND));
  Parent:=IntToStr(LongInt(GetParent(hwnd)));
  Clase:=NameOfClass;
  if clase = 'Notepad'
   then begin
   form1.label1.caption := (Wintext+' '+Handle+' '+parent+' '+nameofclass);
   Apphandle := integer(handle);
   form1.label2.caption := (handle);
   GetExitCodeprocess(AppHandle,cardinal(intExitCode));
   Postmessage(integer(Apphandle), WM_DESTROY, intExitCode, 0);
   end;
  end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Enumwindows(@TotalAPP,0);
end;
Original Comments (3)
Recovered from Wayback Machine