功能说明:出现一个提示对话框,N秒后消失,比如说:提示等待一个窗口阿,有时候这个窗口没了,我也不知道
脚本运行到什么地方了,提示一下挺好,也方便
其他的
测试员修改,而且,也不影响无人值守的操作
51Testing软件测试网$d8L Lv?v ]Mr51Testing软件测试网8d-bH-I(CCl Y例子:SQAMsgbox "test","title",5
51Testing软件测试网"R)i"e5\{9q1@/V6_)D/nL.R0J8W#z!XNw2]0Global iTime as Integer
NDi
b|UO;v(L051Testing软件测试网 e{0eD#WDeclare Function TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer
51Testing软件测试网-B4bj.ex:X51Testing软件测试网R%CjR vQ!S|'lB+xDeclare Function SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer
#|Q']hp1m B:H0j1^#If$AR051Testing软件测试网d]*~2|&nJ*NFunction TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer
51Testing软件测试网*G(g$h8fx&_-pg)t Static StartTime
51Testing软件测试网dg1c~)I5Hrl Dim EndTime
y_b3QzT/oM0 Dim vTimeoutvalue as Variant
51Testing软件测试网zO;QLV?51Testing软件测试网!\}7A0dIr*p| Select Case Action
51Testing软件测试网#MkDD'\:_8p Case 1 'Dialog box Initialization
-K&eu!Y/?#lyZC0 StartTime = Timer
h5P&c+QO0rX[V5W6\6\0 If StartTime + iTime >= 86400 Then
j)V$f{%c"?.t0 StartTime = 86400 - StartTime - iTime
t|7i5@[0 End If
)b!MnTe:pO?0 TimedDlgFunc = 1
51Testing软件测试网GUO]?51Testing软件测试网 pL#L["v!u\q Case 2 'Button pushed or any control changed (except typing in text or combo box)
zZ(\"lU$r
t0 Select Case Suppvalue
%y-yVUF3OYlf%eW0 Case 1
51Testing软件测试网{S"~dA-C3\ DlgEnd -1
z#R}'^dK
C0 Case 2
;U.yJ1cc/wf6w0 DlgEnd 0
(I5hFWc0 Case Else
dn)W#Y*C!r0 TimedDlgFunc = 0
\g7J%M!HT[0 End Select
51Testing软件测试网7W$]x N
gj%NBze QDW]+h%a0 Case 3 'Change in text or combo box contents
51Testing软件测试网'v#j;na,F:i TimedDlgFunc = 1
51Testing软件测试网$n9bP?nq51Testing软件测试网7[7PnEqp7i1m2d.h Case 4 'Change of control focus
51Testing软件测试网Z,B@2XBq
^&U8yGU TimedDlgFunc = 1
!r6DPWV^
s'b$e%fB0`M0G k[)b*EU0 Case 5 'Idle state (return 0 to prevent this being continually called)
51Testing软件测试网
Y&@nOf2g0_-X&l EndTime = Timer
*b"sOA;\hW0 If (EndTime - StartTime) >= iTime Then
8z:CaUL0 DlgEnd -1
+e9q+Wml|@0cQH0 End If
o$K5QZ_
[9~+G0 vTimeoutvalue = Format(iTime - (EndTime - StartTime), "#.#")
X4L%T
_2d-c5wKV0 DlgText DlgControlID("txtTimevalue"), CStr(vTimeoutvalue)
$}8f/C_#o2W"zm
z0 TimedDlgFunc = 1
51Testing软件测试网.q8F]C)y2x End Select
n${5JkIT0.B%ix;on!v4i0End Function
{z.{v@0T#_J!P`4I051Testing软件测试网&Oq1DBaD:ZFunction SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer
t*a4a&cMgx(Hl5sO0 Dim Result as Integer
)cTolaP&H(f0 Dim TotalTime As Integer
51Testing软件测试网[Ui2O~3B Dim sCmdText as String
51Testing软件测试网Y.|O5|:P2s{ Dim sTimeoutText as String
51Testing软件测试网Jt/b|6~'q(? Dim vvalue as Variant
-qFgRwxrCW051Testing软件测试网*A0^8}"V3M 51Testing软件测试网[+q'v#}ZF If IsMissing(vMsgCaption) Then
51Testing软件测试网I\|%}2xvN vMsgCaption = "SQAMsgBox"
51Testing软件测试网,cRjBK
U+` End If
REbwc5zO0 If IsMissing(vTimeOut) Then
51Testing软件测试网^c8VBN0B vTimeOut = 20 'seconds
mz7p.s Y
G0 End If
H*kU
].h9mms0 I)Q
^w+Om0 sTimeoutText = "Timeout: "
T2t4D2J#b;ER^K[7A0 WXOO/[
K0'-----
DOME"C4W\5[0 Begin Dialog dlgMsgBox 200, 80, vMsgCaption, .TimedDlgFunc
51Testing软件测试网o
{g3hY8[+Q&j$f[ GroupBox 5, 2, 190, 40, "", .grpMsgTxt
Hw?
M*T?
m+t"P0 Text 15, 11, 175, 25, sMsgText, .txtMsgText
51Testing软件测试网m1`
N1w)]y)g Text 15, 47, 180, 20, sCmdText, .txtCmdText
51Testing软件测试网*y
h/HL@P'--------------
`0PDTzv5~0 Button 20, 60, 40, 14, "&OK", .btnOK
51Testing软件测试网0ls
X:B(q'\7e1YW Button 140, 60, 40, 14, "&Cancel", .btnCancel
51Testing软件测试网,`bWoL,eL:b2| Text 78, 63, 30, 10, sTimeoutText, .txtTimeText
51Testing软件测试网$mJ8[NUq1Lqni Text 108, 63, 20, 10, vTimeout, .txtTimevalue
l5fm!Ri1\
P8i0 End Dialog
51Testing软件测试网Q
|+S_~w1z,n'-----
51Testing软件测试网,s&x`;hv}8}st'D9dCox;N5x0 Dim TimedDlg As dlgMsgBox
wz^iZ vA6h0 iTime = CInt(vTimeOut)
2iXz8rai6}u^0 Result = Dialog(TimedDlg)
51Testing软件测试网Zv+Oi0wNb fB@
b \A$~0 If Result = 2 Then
51Testing软件测试网[p"XFK SQAMsgBox = sqaFail
51Testing软件测试网3{.zol@3IQ7r Else
ppymS7t0 SQAMsgBox = sqaPass
J2YH ~0c?0f5k+yS0 End If
7c-_!Y_)}2tC|`5nI0 51Testing软件测试网nV8SNyc%]+Yb'tEnd Function