「外部アプリケーションに値を渡す(IE)」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
以下はyahooのページを開いて、自動ログインする例です。
まず、 Microsoft HTML Object Library と Microsoft Internet Controlsを参照設定して下さい。
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.Visible = true;
object Dummy = System.Type.Missing;
IE.Navigate("https://login.yahoo.co.jp/config/login?.src=www&.v=0&.u=7brp2jl0o60ss&.last=&promo=&.intl=jp&.bypass=&.partner=&.protoctl=&pkg=&stepid=&.done=http%3a//www.yahoo.co.jp", ref Dummy, ref Dummy, ref Dummy, ref Dummy);
while (IE.Busy) {};
mshtml.HTMLDocument doc = ((mshtml.HTMLDocument)IE.Document);
((mshtml.HTMLInputTextElement)doc.all.item("login",0)).value = "あなたのyahooID";
((mshtml.HTMLInputTextElement)doc.all.item("passwd",0)).value = "あなたのパスワード";
((mshtml.HTMLFormElement)doc.forms.item("login_form",0)).submit();
以下はyahooのページを開いて、自動ログインする例です。
まず、 Microsoft HTML Object Library と Microsoft Internet Controlsを参照設定して下さい。
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.Visible = true;
object Dummy = System.Type.Missing;
IE.Navigate("https://login.yahoo.co.jp/config/login?.src=www&.v=0&.u=7brp2jl0o60ss&.last=&promo=&.intl=jp&.bypass=&.partner=&.protoctl=&pkg=&stepid=&.done=http%3a//www.yahoo.co.jp", ref Dummy, ref Dummy, ref Dummy, ref Dummy);
while (IE.Busy) {};
mshtml.HTMLDocument doc = ((mshtml.HTMLDocument)IE.Document);
((mshtml.HTMLInputTextElement)doc.all.item("login",0)).value = "あなたのyahooID";
((mshtml.HTMLInputTextElement)doc.all.item("passwd",0)).value = "あなたのパスワード";
((mshtml.HTMLFormElement)doc.forms.item("login_form",0)).submit();
-※いっしょにMicrosoft.mshtml.dllも配布しないと動かない。