| View previous topic :: View next topic |
| Author |
Message |
Analian Guest
|
Posted: Tue May 24, 2005 6:56 pm Post subject: Preventing alt + F4 from action |
|
|
I think there was a topic on the thread but couldn't find it. Sorry, if
reposting. So..
How to prevent a form (not the main form) from closing except when explicit
calls to Close() are made?
I mean that no things like alt + F4 or others should close the form except
for when the user
click the button "Close" for example. Thank you.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue May 24, 2005 8:19 pm Post subject: Re: Preventing alt + F4 from action |
|
|
"Analian" <analian (AT) mail (DOT) bg> wrote
| Quote: | How to prevent a form (not the main form) from closing except
when explicit calls to Close() are made?
|
Use the OnCloseQuery or OnClose event. Set a flag somewhere before calling
Close() so that the event handler knows that you want to close the form. If
the flag is not set, either event can prevent the closure.
Gambit
|
|
| Back to top |
|
 |
Analian Guest
|
Posted: Tue May 24, 2005 8:38 pm Post subject: Re: Preventing alt + F4 from action |
|
|
I had the same idea in mind but how to see if the border icon 'x' wasn't
clicked?
In this case I'd like the form to act as if Cancel was clicked.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue May 24, 2005 10:28 pm Post subject: Re: Preventing alt + F4 from action |
|
|
"Analian" <analian (AT) mail (DOT) bg> wrote
| Quote: | how to see if the border icon 'x' wasn't clicked?
|
Pressing the Close button issues a WM_SYSCOMMAND message with a uCmdType of
SC_CLOSE and xPos and yPos values provided.
Pressing ALT+Tab also issues a WM_SYSCOMMAND message with a uCmdType of
SC_CLOSE, but both the xPos and yPos are 0 indicating a mnenomic was used.
Gambit
|
|
| Back to top |
|
 |
Analian Guest
|
Posted: Fri May 27, 2005 5:42 pm Post subject: Re: Preventing alt + F4 from action |
|
|
Thanks again, Gambit. Now the form seems to work as indended.
|
|
| Back to top |
|
 |
|