views:

378

answers:

2

I've got a VBScript that calls a Visual FoxPro Instance and runs a VFP program. Part of this program produces a messagebox. However, if my script is run from the Windows GUI (rather than a Command Prompt), then the message box produced doesn't necessarily come to the foreground.

In VBScript I have the following code:

Set oVFP = CreateObject("VisualFoxPro.Application")
oVFP.DoCmd("Messagebox('Hello World')")
Set oVFP = Nothing

When I run this script from a DOS prompt, the message box pops to the foreground. When I double-click on the script in Explorer, the Explorer window may be covering the produced messagebox. There is no indication (no extra buttons on Start bar, for example) that the messagebox is hiding back behind the Explorer window waiting for user action.

Is there a way to force the produced messagebox to the foreground?

+2  A: 

Add the undocumented 'System Modal' flag to the MessageBox options:

Set oVFP = CreateObject("VisualFoxPro.Application")
oVFP.DoCmd("Messagebox('Hello World', 4096)")
Set oVFP = Nothing
Stuart Dunkeld
A: 

That did the trick, Stuart! Many thanks!

Jonathan Shay