1. C# WindowsFormApplication 만들고
2. 참조에 Microsoft.mshtml 추가
3. 폼 코드보기에서 아래 내용으로 변경
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using mshtml;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("http://mdinside.co.kr/", false);
}
private void button1_Click(object sender, EventArgs e)
{
mshtml.HTMLDocument HTMLDoc = new HTMLDocument();
HTMLDoc = (mshtml.HTMLDocument)webBrowser1.Document.DomDocument;
IHTMLElement fhead = (IHTMLElement)HTMLDoc.getElementsByName("fhead").item(null, 0);
IHTMLElement mb_id = (IHTMLElement)HTMLDoc.getElementsByName("mb_id").item(null, 0);
IHTMLElement mb_password = (IHTMLElement)HTMLDoc.getElementsByName("mb_password").item(null, 0);
mb_id.setAttribute("value", "아이디", 0);
mb_password.setAttribute("value", (Object)"비밀번호", 0);
webBrowser1.Document.InvokeScript("fhead_submit", new Object[] { fhead });
}
}
}
'Program > C#' 카테고리의 다른 글
C#에서 C++ DLL의 Call by Referance out 인수 사용하는 방법 (0) | 2011.03.24 |
---|---|
C#에서 Win32 API 사용하기2 (0) | 2011.03.24 |
급여 계산 (0) | 2011.03.24 |
체중 관리 프로그램 (0) | 2011.03.24 |
윈도우를 종료 (0) | 2011.03.24 |