Detecting a dialog

P

Phill W.

Is there any way for a Form to detect that it has a Modal dialog displayed
"above" it and to get hold of a reference with which to manipulate that
dialog?

I have a Windows Forms application that can display several dialogs
(custom Forms contained in an external assembly - all my own code).
I'd like to be able to shut the application down remotely (say, at lunch
time in our Development environment so that updates can be released).

While Closing the main form, is there any way that I can "get hold" of the
dialog in order to take "ask" it to take some "Cancel" or "Close" action?
I suppose I /could/ track down the Windows handle for the Close button
and send that a WM_Click message, but is there a more elegant way?

TIA,
Phill W.
 
C

Cor Ligthert [MVP]

Phill,

There are probably hundreds of posibilities to create forms.

From that it depends if you can see an other form.

The most simple one is probably if there is an owner. Than you can using the
owner collection see the status of its childs.

Start it with
frm.owner = me

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top