TheRealLoki
asked on
How to close dialogs open on main form - *from* the main form
I have searched EE and have not found a suitable solution. I have also googled with no luck yet.
When my application receives a certain wm_Timer message,
I want to close all the dialogs over the main form of my application
Important: There may be 2 levels of dialogs (e.g. dialog1 which has an opendialog showing).
The solution needs to be abstract, I will _not_ have variable names (fdialog1) nor classnames (tfdialog1) to use
I already have the wm_timer part
private
procedure WMTimer( var Msg : TMessage ); message wm_timer;
...
procedure TForm1.WMTimer(var Msg: TMessage);
begin
if msg.wParam = 101 then
begin
// close modal dialog boxes here
end;
end;
When my application receives a certain wm_Timer message,
I want to close all the dialogs over the main form of my application
Important: There may be 2 levels of dialogs (e.g. dialog1 which has an opendialog showing).
The solution needs to be abstract, I will _not_ have variable names (fdialog1) nor classnames (tfdialog1) to use
I already have the wm_timer part
private
procedure WMTimer( var Msg : TMessage ); message wm_timer;
...
procedure TForm1.WMTimer(var Msg: TMessage);
begin
if msg.wParam = 101 then
begin
// close modal dialog boxes here
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.