|
-
January 20th, 2008, 05:46 PM
#1
Want Alt+F4 to close my app
Hi all
For some reason Alt+F4 doesnt close my application.
I would like the application to behave predictably and close when the user presses these keys.
I have the KeyPreview set to True in the form properties.
How come this key combination doesnt work? I thought it was a Windows default feature.
Any pointers would be appreciated
Many thanks
-
January 20th, 2008, 09:22 PM
#2
Re: Want Alt+F4 to close my app
What's the code you have in your form_keypress event?
Be nice to Harley riders...
-
January 21st, 2008, 03:57 AM
#3
Re: Want Alt+F4 to close my app
Absolutely nothing.
Thanks for getting back to me
Adrian
-
January 21st, 2008, 06:43 AM
#4
Re: Want Alt+F4 to close my app
Strange. Alt+F4 works for me whether KeyPreview is true or false...
What code have you got in your form? Does Alt+F4 relly absolutely nothing?
-
January 21st, 2008, 08:44 AM
#5
Re: Want Alt+F4 to close my app
hi
yes that's very odd.
the app has about six forms. Some have virtually no code at all. more of a message box really. just an ok button that unloads that message form.
Even these small forms don't close using alt+F4.
I will gladly post the code for the other forms but there is tons of it and none relate to sendkeys or any reference to key strokes. mainly just simple calculations.
perhaps I could do some code to invoke a window close if the alt+F4 is pressed.
any suggestions on how I would go about that?
I did think my situation was odd as on seraching the forum I found everyone wanted to disable the alt+f4 +hich rather pointed to the fact that it usually wrks by default.
thanks for your continued help chaps
-
January 21st, 2008, 09:41 AM
#6
Re: Want Alt+F4 to close my app
I'm thinking about 2 possible reasons ( which you have to confirm, as I have no clue as to what your forms look like )
Issue 1
Is the particular form's ControlBox property set to False ¿
Issue 2
Is the particular form's BorderStyle property set to 0 - None ¿
-
January 21st, 2008, 09:46 AM
#7
Re: Want Alt+F4 to close my app
ah!!! yes the control box is set to false on all forms.
I will set to true and report back.
thanks hamster, I have a feeling you might be on to it.
regards
adrian
-
January 21st, 2008, 06:40 PM
#8
Re: Want Alt+F4 to close my app
Well that is that sorted out.
yes setting the control box to true re-instates the alt+f4 function.
many thanks
It begs another question:-
I set the control box to false to ensure that the user closed the app via my close button, thus allowing code to fully unload the visable window and any that may be running as hidden.
How can I detect if the X button in the control box has been clciked instead of my close button?
Adrian
-
January 21st, 2008, 06:49 PM
#9
Re: Want Alt+F4 to close my app
The form has an event. I think it is Query_UnLoad. That gets fired anytime the form starts to close.
-
January 21st, 2008, 07:37 PM
#10
Re: Want Alt+F4 to close my app
Yes. And to be more specific, the parameter UnloadMode defines the mode of how unload was forced.
0 = close button or alt-f4
1 = Unload Me command
Are there more?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|