Home > VBScript > VBScript – vbSystemModal

VBScript – vbSystemModal


When using a msgbox you can use "vbSystemModal" to make the prompt stay on top of all windows.  You can try the code in the example below to give it a try.  When you run it and are asked "Is now a good time?" try opening other applications – this prompt should stay on top of the other windows.  You will notice that the "You answered yes" and the "You answered no" prompts will not stay on top because we did not tell them to.
 
If you use this with an HTA the prompt will stay on top but the HTA will go behind other windows.  But, once the prompt is answered the focus goes back to the HTA – keep in mind that other windows can still go on top of the HTA but the prompt should bring attention to it.
 
Example:
 intAnswer = Msgbox("Is now a good time?", vbYesNo  + vbSystemModal, "Question")
 If intAnswer = vbYes Then
  Msgbox "You answered yes."
 Else
  Msgbox "You answered no."
 End If
Advertisements
Categories: VBScript
  1. No comments yet.
  1. October 14, 2010 at 4:11 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: