不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

SQAMsgbox 函数讲解

上一篇 / 下一篇  2007-02-05 16:02:56 / 个人分类:Robot技术

功能说明:出现一个提示对话框,N秒后消失,比如说:提示等待一个窗口阿,有时候这个窗口没了,我也不知道脚本运行到什么地方了,提示一下挺好,也方便其他测试员修改,而且,也不影响无人值守的操作51Testing软件测试网$d8LLv?v]Mr
51Testing软件测试网8d-bH-I(CClY
例子:SQAMsgbox "test","title",551Testing软件测试网"R)i"e5\{9q1@/V

6_)D/nL.R0J8W#z!XNw2]0Global iTime as Integer
NDi b|UO;v(L051Testing软件测试网e{0eD#W
Declare Function TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer51Testing软件测试网-B4bj.ex:X
51Testing软件测试网R%CjR vQ!S|'lB+x
Declare Function SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer
#|Q']hp1m B:H0
j1^#If$AR051Testing软件测试网d ]*~2|&nJ*N
Function TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer51Testing软件测试网*G(g$h8fx&_-pg)t
    Static StartTime51Testing软件测试网dg1c ~)I5H rl
    Dim EndTime
y_b3QzT/oM0    Dim vTimeoutvalue as Variant51Testing软件测试网zO;QLV?
51Testing软件测试网!\}7A0dIr*p|
    Select Case Action51Testing软件测试网#Mk D D'\:_8p
        Case 1      'Dialog box Initialization
-K&e u!Y/?#lyZC0                StartTime = Timer
h5P&c+QO0
rX[V5W6\6\0                If StartTime + iTime >= 86400 Then
j)V$f{%c"?.t0                        StartTime = 86400 - StartTime - iTime
t|7i5@[0                End If
)b!MnT e:pO?0                TimedDlgFunc = 151Testing软件测试网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-yVUF3OY lf%eW0                Case 151Testing软件测试网{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 Select51Testing软件测试网7W$]xN gj%NB

ze QDW]+h%a0        Case 3      'Change in text or combo box contents51Testing软件测试网'v#j;na,F:i
                TimedDlgFunc = 151Testing软件测试网$n9bP?nq
51Testing软件测试网7[7PnEqp7i1m2d.h
        Case 4      'Change of control focus51Testing软件测试网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:Ca UL0                        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 = 151Testing软件测试网.q8F]C)y2x
    End Select
n${5JkIT0
.B%ix;on!v4i0End Function
{z.{v@0
T#_J!P `4I051Testing软件测试网&O q1DBaD:Z
Function SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer
t*a4a&cMgx(Hl5sO0    Dim Result as Integer
)cTo laP&H(f0    Dim TotalTime As Integer51Testing软件测试网[Ui2O~3B
    Dim sCmdText as String   51Testing软件测试网Y.|O5|:P2s{
    Dim sTimeoutText as String51Testing软件测试网 Jt/b|6~'q(?
    Dim vvalue as Variant
-qFgRwxrCW051Testing软件测试网*A0^8}"V3M
   51Testing软件测试网 [+q'v#}ZF
    If IsMissing(vMsgCaption) Then51Testing软件测试网I\|%}2xvN
        vMsgCaption = "SQAMsgBox"51Testing软件测试网,c RjBK U+`
    End If
REbwc5zO0    If IsMissing(vTimeOut) Then51Testing软件测试网^c8VBN0B
        vTimeOut = 20       'seconds
m z7p.sY G0    End If
H*kU ].h9mms0
I)Q ^w+Om0    sTimeoutText = "Timeout: "
T2t4D2J#b;ER^K [7A0   
WXO O/[ K0'-----
DO ME"C4W\5[0    Begin Dialog dlgMsgBox 200, 80, vMsgCaption, .TimedDlgFunc51Testing软件测试网o {g3hY8[+Q&j$f[
        GroupBox 5, 2, 190, 40, "", .grpMsgTxt
Hw? M*T? m+t"P0        Text 15, 11, 175, 25, sMsgText, .txtMsgText51Testing软件测试网m1` N1w)]y)g
        Text 15, 47, 180, 20, sCmdText, .txtCmdText51Testing软件测试网*y h/HL@P
'--------------
`0PDTzv5~0        Button 20, 60, 40, 14, "&OK", .btnOK51Testing软件测试网0ls X:B(q'\7e1YW
        Button 140, 60, 40, 14, "&Cancel", .btnCancel51Testing软件测试网,`bW oL,e L:b2|
        Text 78, 63, 30, 10, sTimeoutText, .txtTimeText51Testing软件测试网$mJ8[NUq1Lqni
        Text 108, 63, 20, 10, vTimeout, .txtTimevalue
l5fm!R i1\ P8i0    End Dialog51Testing软件测试网Q |+S _~w1z,n
'-----51Testing软件测试网,s&x`;hv}8}

s t'D9dC ox;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 Then51Testing软件测试网[p"XFK
        SQAMsgBox = sqaFail51Testing软件测试网3{.zol@3IQ7r
    Else
ppymS7t0        SQAMsgBox = sqaPass
J2YH~0c?0f5k+yS0    End If   
7c-_!Y_)}2tC |`5nI0   51Testing软件测试网nV8SNyc%]+Yb't
End Function

TAG: 软件测试技术 Robot技术

 

评分:0

我来说两句

Open Toolbar