Intercepted message to manage Windows
Summary: How to use a program to intercept messages for managing Windows
Keywords: Windows message listening list
Category: System Control
Sometimes we manage Windows messages for multiple applications. How can we do it?
{This example defined program to charge all messages sent to the main window}
Unit Testeandoesta;
Interface
Uses
Sysutils, Wintypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, Menus
Type
TFORM1 = Class (TFORM)
Private {private declarations}
PUBLIC {public declarations}
Procedure WinMsg (VAR MSG: TMSG; VAR HANDED: BOOLEAN);
END;
VAR
FORM1: TFORM1;
IMPLEMENTATION
{$ R * .dfm}
{All messages sent to the main form, saved in the variable MSG. }
Procedure TFORM1.WINMSG (VAR MSG: TMSG; VAR HANDED: BOOLEAN);
Begin
If msg.Message = WM_SYSCOMMAND THEN BEEP;
{Notifications when receiving messages}
END;
Procedure TFORM1.FormCreate (Sender: TOBJECT);
Begin
Application.onMessage: = WINMSG;
{Replacement message Bing}
END;