Close Window via SendMessage - Delphi

DarkCoderSc personal avatar
DarkCoderSc

Jean-Pierre LESUEUR

var ATargetWindow := FindWindow(nil, 'Untitled - Notepad');
if ATargetWindow = 0 then
    Exit();

SendMessage(ATargetWindow, WM_CLOSE, 0, 0);

Creating and researching code snippets takes time and effort. You’re welcome to share them through your own platforms, but please don’t forget to credit the original author, here: Jean-Pierre LESUEUR.

Implemented By Technique


Created

April 24, 2025

Last Revised

April 24, 2025