Is it possible to tell a VBScript to use Windows Visual Styles, so that any form components use Windows themed ones rather than classic ones? For example, to make a MsgBox show a styled button rather than a classic 3D raised square one.
This:
As opposed to this:
VBScript is a programming language included with Microsoft Internet Explorer. For other browsers, contact your vendor about support. VBScript 2.0 (or later) is recommended for use with Agent.
Since Windows 10 build 16237: “VBScript is deprecated in Internet Explorer 11, and is not executed for web pages displayed in IE11 mode.
Yes, Windows 11 supports VBScript files.
In HTA applications, A simple meta
tag will turn on Visual Styles:
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="yes">
This trick has seemed to disappear completely from Google search results, leaving this S/O question at the top!
In the case where a VBScript MsgBox
is the culprit, one would have to modify wscript host
to use visual styles. But for the sake of the post, you can easily make your own replica of a MsgBox using an HTA file, and turning on visual styles. I created an exact replica based off your screenshot:
msgbox.hta:
<html>
<head>
<title>MsgBox Title</title>
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="yes">
<HTA:APPLICATION ID="Custom MsgBox"
APPLICATIONNAME="Custom MsgBox"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
CONTEXTMENU="no"
ICON=""
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="no"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal"/>
<script language="javascript">window.resizeTo(400,170);</script>
</head>
<body style="font-family:Arial;padding:20px 0 0 20px;background:rgb(180,240,230)">
<p>MsgBox Body; lorem ipsum dipsum</p><br>
<div align="right"><button onclick="window.close()" style="width:80px">OK</button></div>
</body>
</html>
It's small enough where you could echo
it into an hta file right from a batch script, if you wanted to.
I hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With