VBS全屏打开图片

时间:2014-03-13 00:31:34

标签: vbscript

有没有办法打开图片,比如全屏'中的弹出窗口?

这是我的代码:

intAnswer = _
    Msgbox("Do you want to open Welcome.png?", _
        vbYesNo, "Open Png?")

If intAnswer = vbYes Then
    Msgbox "Opening..."
    "open %userprofile%/directory/welcome.png in fullscreen"
Else
    Msgbox "Not opening..."
End If

1 个答案:

答案 0 :(得分:3)

单独使用VBScript无法全屏显示图片。您需要一个应用程序来进行显示。例如,HTA可以工作:

<head>
<title>SplashScreen</title>
<HTA:APPLICATION ID="oHTA"
  APPLICATIONNAME="SplashScreen"
  SCROLL="no"
  SINGLEINSTANCE="yes"
  WINDOWSTATE="maximize"
>
<style type="text/css">
* {
  margin: 0;
  padding: 0;
  border: 0;
}
</style>
</head>

<script language="VBScript">
  Sub Window_onLoad
    document.all.splash.width = document.body.offsetWidth
    document.all.splash.height = document.body.offsetHeight
  End Sub
</script>

<body>
<p><img id='splash' src='C:\path\to\your.jpg'></p>
</body>

从VBScript中运行它:

If intAnswer = vbYes Then
    Msgbox "Opening..."
    CreateObject("WScript.Shell").Run "C:\path\to\your.hta", 1, True
Else
    Msgbox "Not opening..."
End If