Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position MSGBox in VBScript 1

Status
Not open for further replies.

BeeDeeBee

Programmer
Dec 18, 2000
5
US
Is there a way to make a MSGBox come up exactly where you want it to on the screen, even if the window is minimized.

The default location of the MSGBOX always overlays an importatnt message to my user.

TIA.

 
No there isn't (other than perhaps invoking the Windows API). I wrote a dll that allows for customized placement, font, logo, size, etc of a "Message Box". If you (or anyone) would like it let me know via e-mail.

Later,
Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Can you move the important message instead?

DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
I would like to have your dll file and a little example on how to use it.

I will really appreciate yourr help.

Regards

Cesar Humberto Parrales
Application Support
 
I would like to have your dll file and a little example on how to use it.

I will really appreciate yourr help.

cesar.parrales@kraftla.com

Regards

Cesar Humberto Parrales
Application Support
 
Well...

While it is true that you don't have any real control over the position of a MsgBox dialog, there are a number of alternatives. One worth considering is the
Code:
popup
functionality within IE.

Look, Ma! No pains, no strains, no ActiveX constraints!
Code:
<HTML>
<HEAD>
<TITLE>Small Popup sample</TITLE>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
  Option Explicit
  Dim objPopup

  Set objPopup = window.createPopup

  Sub btnGo_onclick()
    With objPopup.document.body
      .style.backgroundColor = &quot;#ffdddd&quot;
      .style.border = &quot;solid #9999ff 2px&quot;
      .innerHTML = _
          &quot;<div style=&quot;&quot;background-color: #0000ff; color: #ffffff&quot;&quot;>&quot; _
        & &quot;Message from our sponsor&quot; _
        & &quot;</div>&quot; _
        & &quot;<div style=&quot;&quot;color: #ff0000; text-align: center&quot;&quot;>&quot; _
        & &quot;Click anywhere outside this popup to close it.&quot; _
        & &quot;</div>&quot;
    End With
    objPopup.show 100, 100, 180, 46, document.body
  End Sub
</SCRIPT>
</HEAD>
<BODY>
  <BUTTON id=btnGo>Pop up a dialog</BUTTON>
</BODY>
</HTML>
There are a number of ways to store the HTML to be used in your popups. VBScript string expressions as above, external HTML files, or hidden <div>s are some of the popular ones.

This not only offers you control over the position of your dialogs, it gives you some amazing options a poor old MsgBox-er could hardly dream of!

See:


As I said, it's one alternative.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top