掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
複数のIE画面からひとつを選択し取り込むには? (ID:85824)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Enumwindowsですか検討してみます。ありがとうございます。 一応、ソースを添付します。一番悩んでる点はプロセス番号で キーボード入力やwebbrowserで取り込めるHPを選択する関数です。 SetActivewindowやSetfocusAPIやSetForegroundWindowや何を使えば いいのやら。色々試してますがプロセス番号でIEの窓をアサインすることは 無理なのでしょうか。もう3ヶ月も悩んでます。お助け下さい。 Option Explicit Private WithEvents ie As SHDocVw.WebBrowser Private doc As MSHTML.HTMLDocument Private Declare Function FindWindow Lib "user32.dll" _ Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32.dll" _ Alias "FindWindowExA" ( _ ByVal hwndParent As Long, _ ByVal hwndChildAfter As Long, _ ByVal lpszClass As String, _ ByVal lpszWindow As String) As Long Private Declare Function GetWindowText Lib "user32.dll" _ Alias "GetWindowTextA" ( _ ByVal hWnd As Long, _ ByVal lpString As String, _ ByVal nMaxCount As Long) As Long Private Declare Function SetForegroundWindow Lib "USER32" (ByVal sWnd As Long) As Long Private Declare Function SetFocusAPI Lib "USER32" Alias "SetFocus" (ByVal hWnd&) As Long 'フォームロード Private Sub Form_Load() Dim sw As New SHDocVw.ShellWindows Dim lngHwnd As Long Dim strTitle As String * 512 Dim hhh As String Dim df Dim rr As Long Dim v Dim fj As String Dim j List1.Clear lngHwnd = 0 Do lngHwnd = FindWindowEx(0, lngHwnd, "IEFrame", vbNullString) If lngHwnd = 0 Then Exit Do Call GetWindowText(lngHwnd,strTitle,Len(strTitle)) List1.AddItem Left(strTitle, InStr(strTitle, vbNullChar) - 1) hhh = Left(strTitle, InStr(strTitle, vbNullChar) - 1) '指定の窓かチェックする j = 0 j = InStr(hhh, "指定の窓") '指定の窓なら出口へ If j > 0 Then Exit Do Loop '指定の窓の場合 If j > 0 Then '指定の窓をアクティブウィンドウにする rr = SetForegroundWindow(lngHwnd) 'SetFocusAPI hhh 'webbrowserで表示する If sw.Count = 0 Then MsgBox "Internet Explorer を先に立ち上げてください" End End If Set ie = sw(0) Set doc = ie.Document fj = doc.body.innerText MsgBox fj
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.