【问题标题】:Show msg box in less than a second在不到一秒的时间内显示消息框
【发布时间】:2012-07-27 20:51:41
【问题描述】:

有没有办法让msgbox在一秒钟内显示并消失,我一直在使用下面的脚本,但只能让它在一秒钟内关闭。

选项显式 Dim Wshell, BtnCode 设置 Wshell = CreateObject("wscript.shell")

BtnCode= Wshell.Popup("test", 1, "testing")

【问题讨论】:

    标签: vbscript


    【解决方案1】:

    恐怕这在弹出窗口中是不可能的。 不过,您可以使用 Internet Explorer 作为 UI 来做到这一点。

    Set oIE = CreateObject("InternetExplorer.Application") 
    
    With oIE 
      .navigate("about:blank") 
      .Document.Title = "Countdown" & string(100, chrb(160)) 
      .resizable=0 
      .height=200 
      .width=100 
      .menubar=0 
      .toolbar=0 
      .statusBar=0 
      .visible=1 
    End With 
    
    ' wait for page to load 
    Do while oIE.Busy 
      wscript.sleep 50 
    Loop 
    
    ' prepare document body 
    oIE.document.body.innerHTML = "<div id=""countdown"" style=""font: 36pt sans-serif;text-align:center;""></div>" 
    oIE.document.all.countdown.innerText= "test message"
    'the parameters is in miliseconds, so here the message is shown for half a second
    wscript.sleep 500
    oIE.quit 
    

    【讨论】:

      猜你喜欢
      • 2012-12-16
      • 1970-01-01
      • 1970-01-01
      • 2013-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-19
      相关资源
      最近更新 更多