Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetMessage API Hook in Form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00888527
Message ID:
00890100
Vues:
27
This message has been marked as the solution to the initial question of the thread.
Brent,

You can set Cancel property of the command button to .T. and in the valid of the textbox check for LASTKEY() = 27 as indicator that Cancel button has been pressed and bypass validation.

>Sergey -
>
>Thank you for responding. Yes, you are right that the QueryUnload event fires when the form is closed. However, let me give you a better explanation of the problem. I wrote the following to David Frankenbach, who also responded to my question:
>
>[What is happening is that I run a main program--not a form--that launches the FoxPro desktop and replaces the FoxPro system menu with my own custom menu (made with the FoxPro menu designer). The user then makes a menu selection which launches a form. That form has a title bar. And, of course, on the left side of the title bar is the Windows OS System Menu represented by the FoxPro fox icon. The options on that menu are "Move" and "Close Ctrl+F4". On the right side of the title bar is the Windows OS close button. When the user clicks the Windows OS close button, or double clicks the fox icon, or selects the "Close Ctrl+F4" menu option, no events fire in the form, including the QueryUnload event. Hence, the form does not close. What I want to have happen is for the form to close, and the user be returned to the custom menu where the user may make other menu choices. In other words, I don't want FoxPro to close--just the form.
>
>To get around this problem, I could remove the tile bar, or I could emulate a title bar. However, these approaches are a little tacky to me. There should be a way to capture the Windows operating system messages (i.e., the WM_SYSCOMMAND messages) that are generated and retrieved with the Windows API GetMessage when the user selects a title bar close option.
>
>Do you know of a way I can retrieve those messages when no form events fire when the user tries to close the form using a title bar close option?]
>
>Sergey, I forgot to tell David something else important: The reason that the form does not close when the user tries closing with one of the title bar close methods is because of code I have in the VALID method of a TextBox control on the form. Let me explain. There is a "Cancel" button on the form. If the user clicks that button, I do not want data in the TextBox control to be validated and, if incorrect, prevent the form's focus from leaving that TextBox. Hence, in the VALID method I have placed code that checks whether the point on the form where the user clicked is contained within the form coordinates of the "Cancel" button. If the point clicked is not part of the "Cancel" button then the focus remains in the TextBox.
>
>I need some way of capturing the title bar close option selections so that I can include additional code in the TextBox VALID method to test for those selections and also allow the focus of the form to leave that control and allow the form to close.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform