Detecting a dialog

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phill  W.

    #1

    Detecting a dialog

    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.


  • Cor Ligthert [MVP]

    #2
    Re: Detecting a dialog

    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



    "Phill W." <p-.a-.w-a-r-d@o-p-e-n.a-c.u-k> schreef in bericht
    news:dtus7m$641 $1@yarrow.open. ac.uk...[color=blue]
    > 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.
    >
    >[/color]


    Comment

    Working...