BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Preventing alt + F4 from action

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Analian
Guest





PostPosted: Tue May 24, 2005 6:56 pm    Post subject: Preventing alt + F4 from action Reply with quote



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





PostPosted: Tue May 24, 2005 8:19 pm    Post subject: Re: Preventing alt + F4 from action Reply with quote




"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





PostPosted: Tue May 24, 2005 8:38 pm    Post subject: Re: Preventing alt + F4 from action Reply with quote



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





PostPosted: Tue May 24, 2005 10:28 pm    Post subject: Re: Preventing alt + F4 from action Reply with quote


"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





PostPosted: Fri May 27, 2005 5:42 pm    Post subject: Re: Preventing alt + F4 from action Reply with quote

Thanks again, Gambit. Now the form seems to work as indended.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.