以下是一个简单的VBS弹窗代码,可以指定弹窗的位置:\n\nvbscript\nSet objShell = CreateObject("WScript.Shell")\n\n' 设置弹窗的标题和内容\nstrTitle = "弹窗标题"\nstrMessage = "弹窗内容"\n\n' 设置弹窗的位置(左上角坐标)\nintLeft = 500\nintTop = 300\n\n' 计算屏幕的宽度和高度\nintScreenWidth = objShell.AppActivate("WScript.Shell").Width\nintScreenHeight = objShell.AppActivate("WScript.Shell").Height\n\n' 计算弹窗的居中位置\nintWindowWidth = 300\nintWindowHeight = 200\nintWindowLeft = intLeft\nintWindowTop = intTop\n\n' 如果弹窗超出屏幕范围,将弹窗位置调整到屏幕内\nIf intWindowLeft + intWindowWidth > intScreenWidth Then\n\tintWindowLeft = intScreenWidth - intWindowWidth\nEnd If\nIf intWindowTop + intWindowHeight > intScreenHeight Then\n\tintWindowTop = intScreenHeight - intWindowHeight\nEnd If\n\n' 弹出消息框\nobjShell.Popup strMessage, , strTitle, 0 + 64 + 524288, intWindowLeft, intWindowTop\n\n\n在以上代码中,可以修改strTitlestrMessage分别设置弹窗的标题和内容。intLeftintTop变量用于设置弹窗的左上角坐标,可以根据需要进行修改。


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

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