Force messagebox to foreground

混江龙づ霸主 提交于 2021-01-29 09:22:44

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/730759/force-messagebox-to-foreground

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!