以下是一个简单的vbs弹窗代码,可以指定弹窗的位置:

Set objShell = CreateObject("WScript.Shell")

' 设置弹窗的标题和内容
strTitle = "弹窗标题"
strMessage = "弹窗内容"

' 设置弹窗的位置(左上角坐标)
intLeft = 500
intTop = 300

' 计算屏幕的宽度和高度
intScreenWidth = objShell.AppActivate("WScript.Shell").Width
intScreenHeight = objShell.AppActivate("WScript.Shell").Height

' 计算弹窗的居中位置
intWindowWidth = 300
intWindowHeight = 200
intWindowLeft = intLeft
intWindowTop = intTop

' 如果弹窗超出屏幕范围,将弹窗位置调整到屏幕内
If intWindowLeft + intWindowWidth > intScreenWidth Then
    intWindowLeft = intScreenWidth - intWindowWidth
End If
If intWindowTop + intWindowHeight > intScreenHeight Then
    intWindowTop = intScreenHeight - intWindowHeight
End If

' 弹出消息框
objShell.Popup strMessage, , strTitle, 0 + 64 + 524288, intWindowLeft, intWindowTop

在以上代码中,可以修改strTitlestrMessage分别设置弹窗的标题和内容。intLeftintTop变量用于设置弹窗的左上角坐标,可以根据需要进行修改

按规定位置出现的vbs弹窗代码

原文地址: https://www.cveoy.top/t/topic/hSSq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录