Is there any event I could use so I’d catch the moment when ShowMessage appears on the screen? I’d also need pass a reference to the TForm which has shown the Message.
So far I tried OnDeactivate, but it seems, ShowMessage is not causing it…
In.NET there is methon on Application that catches every MessageBox (Application.AddFilterMessage or smth like this), I’d need something like this in delphi
What I’m trying to achive is:
I must catch the moment while a dialog window appears (or just a modal window, but it’s not that comfortable). I need to do couple of instructions then. Goal of those instructions is to give me a refference to the just recieved DialogWindow so I could for example get a number of buttons that lies on it.
In modern Delphi versions, on modern Windows versions,
ShowMessageresults in a Windows dialog window. You can use aWH_CBThook to catch the activation of that dialog window.Note that the actual window class name varies from system to system. On XP the class name will be
TMessageFormbecause the dialog is actually a DelphiTForm. However, on Vista and later the dialog is a standard window message box dialog with window class name#32770.I’ve shown this wrapped around a single call to
ShowMessage, but you could install this at startup if you want to hook all message dialogs shown in your app.