Board index » cppbuilder » Form1->Close(), Sender

Form1->Close(), Sender

Hello everyone,
 I was wondering how I can tell if a form is closed by the user clicking
the 'X' in the top right of the form as opposed to a Form1->Close().
In the FormClose both seem to return the same Sender of 'Form1'.
Thanks in advance.
Regards Digby Millikan.
 

Re:Form1->Close(), Sender


Hi, Digby!

AFAIK, you can't, because Window's doesn't send that information. If you
must know, you will have to create your own close button and wedge the
system menu for the window.

Why does it matter?

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------

Re:Form1->Close(), Sender


Hello Digby,

Digby Millikan <dig...@one.net.au> schreef in berichtnieuws
8csl60$q...@bornews.borland.com...

Quote
> Hello everyone,
>  I was wondering how I can tell if a form is closed by the user clicking
> the 'X' in the top right of the form as opposed to a Form1->Close().
> In the FormClose both seem to return the same Sender of 'Form1'.

Have a look at the OnCloseQuery() event. That gets fired if any close action
is ordered from anywhere.

Quote
> Thanks in advance.

Hope this helped...;-))

Quote
> Regards Digby Millikan.

--
Greetings from sunny Amsterdam

                Jan

email: bijs...@worldonline.nl
http://home.worldonline.nl/~bijster

Re:Form1->Close(), Sender


Hi Digby,

Quote
> I was wondering how I can tell if a form is closed by the user clicking
> the 'X' in the top right of the form as opposed to a Form1->Close().
> In the FormClose both seem to return the same Sender of 'Form1'.

Handle the WM_SYSCOMMAND message and look for the SC_CLOSE type.  If you're
specifically interested in closing via the "X" button, you may need also handle
the WM_NCHITTEST message.

Good luck!

--
Damon Chandler (TeamB)
http://bcbcaq.freeservers.com

Re:Form1->Close(), Sender


Thanks Damon,
 I thinking of closing my application by the "X" rather than just
Form.
Regards Digby Millikan.

"Damon Chandler (TeamB)" <dm...@cornell.edu> wrote in message
news:38F3E0DD.8306982@cornell.edu...

Quote
> Hi Digby,
> > I was wondering how I can tell if a form is closed by the user clicking
> > the 'X' in the top right of the form as opposed to a Form1->Close().
> > In the FormClose both seem to return the same Sender of 'Form1'.

> Handle the WM_SYSCOMMAND message and look for the SC_CLOSE type.  If
you're
> specifically interested in closing via the "X" button, you may need also
handle
> the WM_NCHITTEST message.

> Good luck!

> --
> Damon Chandler (TeamB)
> http://bcbcaq.freeservers.com

Other Threads