When my app fires an event, I need to know if at that time I have a MessageDlg (or some other system dialog) open.Presuming your question is on Windows and that the MessageDlg is owned by your application (not the desktop for instance), one fairly simple way is to enumerate the windows owned by your app. There is usually a piece of information you can obtain using the window handle that will allow you to identify a dialog.
How to figure that out?
When my app fires an event, I need to know if at that time I have a MessageDlg (or some other system dialog) open.Application dialogs - by (Application.ModalLevel > 0). System dialogs - using System API.
There is
function GetCurrentModalForm: TCustomForm;
Presuming your question is on Windows ...
... and that the MessageDlg is owned by your application (not the desktop for instance)
Application dialogs - by (Application.ModalLevel > 0). System dialogs - using System API.
So Application.ModalLevel > 0.Application dialogs - by (Application.ModalLevel > 0). System dialogs - using System API.
My fault: I mean the dialog shown by MessageDlg() or ShowMessage() functions.
So Application.ModalLevel > 0.Application dialogs - by (Application.ModalLevel > 0). System dialogs - using System API.
My fault: I mean the dialog shown by MessageDlg() or ShowMessage() functions.