Created
June 6, 2015 11:09
-
-
Save dck-jp/1f72d203c38b773ccc37 to your computer and use it in GitHub Desktop.
SHDocVwSample04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ページの読み込み完了まで待機するための拡張メソッド | |
public static class SHDovVwEx | |
{ | |
public static void Wait(this SHDocVw.InternetExplorer ie, int millisecond = 0) | |
{ | |
while (ie.Busy == true || ie.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) | |
{ | |
Thread.Sleep(100); | |
} | |
Thread.Sleep(millisecond); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//拡張メソッドの使い方 | |
public void WaitTest() | |
{ | |
var IE = new SHDocVw.InternetExplorer(); | |
IE.Visible = true; | |
object URL = "http://www.google.com/"; | |
IE.Navigate2(ref URL); | |
IE.Wait(); //続いてページ内の要素を書き換えるために、ページが表示されるまで待機 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment