GUICreate('邮件发送', 450, 500)
$Group1 = GUICtrlCreateGroup('基本配置', 8, 8, 330, 300)
$SmtpServer_Label = GUICtrlCreateLabel('SMTP服务器', 20, 40, 80, 20)
$UP_Label = GUICtrlCreateLabel('用户名/密码', 20, 70, 80, 20)
$FromAddress_Label = GUICtrlCreateLabel('From', 20, 100, 80, 20)
$To_Label = GUICtrlCreateLabel('To', 20, 130, 80, 20)
$Subject_Label = GUICtrlCreateLabel('标题', 20, 160, 80, 20)
$Body_Label = GUICtrlCreateLabel('正文', 20, 190, 80, 20)
$Start_Label = GUICtrlCreateLabel('起始', 20, 360, 80, 20)
$Start_Label = GUICtrlCreateLabel('数量', 80, 360, 80, 20)
$SMTP = GUICtrlCreateInput('', 100, 40, 220, 20)
$Username = GUICtrlCreateInput('', 100, 70, 100, 20)
$Password = GUICtrlCreateInput('', 220, 70, 100, 20, 0x0020)
$From = GUICtrlCreateInput('', 100, 100, 220, 20)
$To = GUICtrlCreateInput('', 100, 130, 220, 20)
$Subject = GUICtrlCreateInput('subject', 100, 160, 220, 20)
$Body = GUICtrlCreateEdit('Mail Body', 100, 190, 220, 100)
$Start = GUICtrlCreateButton('Start', 340, 200, 70)
$Stop = GUICtrlCreateButton('Stop', 340, 280, 70)
$Label = GUICtrlCreateLabel('准备Send', 80, 400, 200, 20)
GUISetState()
GUIRegisterMsg(0x0111, 'WM_COMMAND')
$pause = True
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Start
GUICtrlSetState($Start, 128)
$var = 1
$pause = False
While $var <= 2000
If $pause Then
GUICtrlSetData($Label, 'Send ' & $var - 1 & ' 已停止')
MsgBox(0, 0, '已停止')
GUICtrlSetState($Start, 64)
ExitLoop
EndIf
GUICtrlSetData($Label, 'Send ' & $var)
sendmail()
$var += 1
WEnd
EndSwitch
WEnd
Func sendmail()
Sleep(2000)
;.....发送邮件
EndFunc ;==>sendmail
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
If $pause = False And $lParam = GUICtrlGetHandle($Stop) Then Dim $tmp = GUICtrlSetData($Label, 'Send ' & $var & ' 停止中...'), $pause = True
EndFunc ;==>WM_COMMAND