Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MessageBox Question
Message
From
29/07/2003 05:59:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/07/2003 21:33:23
Rene Lovino
Bigfoot Global Solutions, Inc
Cebu, Philippines
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00814002
Message ID:
00814452
Views:
7
>>Hi All,
>>
>>Is anybody there have an idea on how to determine if the messagebox window appear on the screen or form?
>>
>>I want to create an automated program that will automatically test my application.
>>This application is responsible of inputting data to my screen.
>>
>>Below is my sample code.
>>
>>keyboard '{alt+t}' && This will trigger my "Transaction" short cut form the menu.
>>keyboard 'i' && This will invoke the "Invoice" funciton.
>>doevents
>>
>>_screen.ActiveForm.CustomerNoText.SetFocus()
>>_screen.ActiveForm.CustomerNoText.value = 'CUSTOMER01'
>>
>>keyboard "{enter}"
>>After this keyboard event there is a messagebox that informed the user that the customer have already exceed the credit limit. This ask the user where to proceed or not by clicking "Yes" or "No" button. I know that I can pass a keyboard event wether to proceed or not. But before I can pass the keyboard command I need to determine first if the messagebox display on the screen.
>>
>>Is it possible to determine it?
>>If possible, How?
>>
>>Any idea would be greatly appreciated.
>>
>>
>>Thank you very much in advance.
>>
>>
>>Rene
>
>Rene,
>Since that messagebox shows up under a special condition you could check the condition too or where it's checked place your keyboard after messagebox().
>In VFP7 and later you could have 4th parameter (timeout) filled, so it advances automatically with your default button.
>Cetin
>
>Hi Cetin,
>
>Thank you for your quick response.
>
>But the messagebox that should appear is not part of my code. It is part of the ActiveForm that have been triggered by the keyboard command as follows.
>_screen.ActiveForm.CustomerNoText.value = 'CUSTOMER01' (This part will input the Customer #)
>keyboard "{enter}" (This part will trigger the validation method of the Customer Text box).
>The messagebox will be display by the validation which is the different program.
>Note that the Invoice Form is already part of the .exe file.
>
>Can we get the object name or window handle of the MessageBox window?
>Or there is an API function that can determine the object name or window handle of the MessageBox window?
>
>
>TIA,
>
>
>Rene

Rene,
Yes there are API's that'd let you check the windows (GetFocus(), FindWindow(), GetForegroundWindo() and so on).
However there might be an easier way. You're doing kind of unattended routine. After [enter] if messagebox is not displayed then another control should get the focus. You might utilize this and check :

if type('_screen.activeform.activecontrol') = 'O'

PS: Forget it. Use GetFocus() API instead.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform