応用

IEを最前面表示

APIのSetForegroundWindowを使って、IEを最前面表示します。

						Public Class Form1

							Private objIE As SHDocVw.InternetExplorer
							Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Boolean

							Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

								objIE = CreateObject("InternetExplorer.Application")
								objIE.Navigate("https://www.yahoo.co.jp")
								objIE.Visible = True

							End Sub

							Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

								'IEを最前面に
								SetForegroundWindow(objIE.HWND)

							End Sub

						End Class