How to close an externally opened application in a Delphi application? Here is an example of closing the "Calculator" program in Delphi: var HWndCalculator:HWnd; Begin // Find the existing calculator window HWndCalculator:= Winprocs.FindWindow(nil, ''calculator''); // Close the existing calculator window if HWndCalculator <> 0 then SendMessage(HWndCalculator, WM_CLOSE, 0, 0); end;