private void SendMask() { if (tbMaskCode.Text.Trim() == "") { return; } for (int i = 1; i <= 8; i++) { System.Windows.Forms.Control ctrl = FindControl(this, "pic" + i.ToString()); if (ctrl != null) { ctrl.Visible = false; } } MaskController.GetInstance().SendMask(tbMaskCode.Text); this.pbImg.Visible = false; this.btnSend.Enabled = false; this.tbSeconds.Text = ""; this.tbMaskCode.Enabled = false; this.tbMaskCode.Text = ""; this.labelInfo.Text = "正在获取验证码"; }
private void MainDlg_Load(object sender, EventArgs e) { this.pbImg.Visible = false; this.Visible = false; MaskController.GetInstance().CurState = OptStatus.NOT_LOGIN; MaskController.GetInstance().HWnd = this.Handle; MaskController.GetInstance().Start(); this.pic1.Parent = this.pbImg; this.pic2.Parent = this.pbImg; this.pic3.Parent = this.pbImg; this.pic4.Parent = this.pbImg; this.pic5.Parent = this.pbImg; this.pic6.Parent = this.pbImg; this.pic7.Parent = this.pbImg; this.pic8.Parent = this.pbImg; //Win32API.SetForegroundWindow(this.Handle); //this.TopMost = true; //this.Activate(); }
protected override void DefWndProc(ref Message m) { switch (m.Msg) { //接收自定义消息MYMESSAGE,并显示其参数 case MsgDef.CLOSE_MSG: { MaskController.GetInstance().WaitStop(1000); System.Environment.Exit(0); } break; case MsgDef.UPDATE_IMG: { this.pbImg.Visible = true; //if(cbAutoShow.Checked) this.btnSend.Enabled = true; this.tbMaskCode.Focus(); this.tbMaskCode.Text = ""; this.tbMaskCode.Enabled = true; this.pbImg.Image = ShowData.GetInstance().Pic; this.Show(); if (cbBeep.Checked) { Win32API.MessageBeep(Win32API.MessageBeepType.Error); } notifyIcon1.Visible = false; if (cbAutoShow.Checked) { this.WindowState = FormWindowState.Normal; Win32API.SetForegroundWindow(this.Handle); this.TopMost = true; this.Activate(); } } break; case MsgDef.CNTR_MSG: { this.tbTodayCntr.Text = ShowData.GetInstance().TodayCntr.ToString(); this.tbRightCntr.Text = ShowData.GetInstance().SuccCntr.ToString(); this.tbErrorCntr.Text = ShowData.GetInstance().FailCntr.ToString(); this.tbInputCntr.Text = ShowData.GetInstance().TyperCntr.ToString(); this.tbWaitCntr.Text = ShowData.GetInstance().RemainCntr.ToString(); this.tbInfor.Text = ShowData.GetInstance().WarnMsg.ToString(); } break; case MsgDef.REMAIN_SECONDS_MSG: { this.tbSeconds.Text = m.WParam.ToString(); this.labelInfo.Text = "请在" + tbSeconds.Text + "秒内输入结果"; //this.Text = "请在" + tbSeconds.Text + "秒内输入结果"; if ((int)m.WParam == 0) { if (tbMaskCode.Text.Trim() != "") { SendMask(); } } } break; case MsgDef.START_BTN_MSG: { if (m.WParam.ToString() == "0") { this.btnStart.Text = "暂停"; this.labelInfo.Text = "欢迎使用19e打码器!"; this.Text = "欢迎使用19e打码器!"; this.tbMaskCode.Focus(); } else { if (m.LParam.ToString() == "1") { this.tbInfor.Text = "3次没有输入,暂停获取验证码"; } this.btnStart.Text = "开始"; this.labelInfo.Text = "欢迎使用19e打码器!"; this.Text = "欢迎使用19e打码器!"; } } break; case MsgDef.HEART_BEAT_MSG: { this.TopMost = false; dotNum = (dotNum + 1) % 10; string str = ""; for (int i = 0; i < dotNum; i++) { str += "."; } this.labelInfo.Text = "正在获取验证码" + str; //this.Text = "正在获取验证码" + str; } break; case MsgDef.LOGIN_MSG: { if (m.WParam.ToString() == "0") { this.Hide(); } else { this.lbLoginInfo.Text = "欢迎你," + SysConfig.GetInstance().UserName; this.Show(); } } break; default: base.DefWndProc(ref m); break; } }
private void btnStart_Click(object sender, EventArgs e) { MaskController.GetInstance().StartGetMask(); }
private void MainDlg_FormClosing(object sender, FormClosingEventArgs e) { notifyIcon1.Visible = false; MaskController.GetInstance().WaitStop(1000); }