掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
IE7「ファイルのダウンロード」のクリック (ID:101462)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こんにちは。 熊谷隆史さんの >どうやらウィンドウが最前面でないと反応しない様です。 を参考に保存して完了までを作ってみました。 Sub FileDownLoad_Proc() Dim strCaption As String Dim PWnd As Long Dim cWnd As Long Dim hDlg1 As Long Dim hDlg2 As Long Dim lngR As Long Dim hWnd1 As Long Dim hWnd2 As Long Dim hWnd3 As Long Dim strBuf As String Dim strA As String Dim nLen As String ' 親ウィンドウ取得 strCaption = "ファイルのダウンロード" PWnd = FindWindowEx(0, 0, "#32770", strCaption) If PWnd = 0 Then Exit Sub ' 保存ボタンのハンドル cWnd = FindWindowEx(PWnd, 0&, "Button", "保存(&S)") ' '保存ボタンを押す Do ' WindowTopMost PWnd, 0 SetForegroundWindow PWnd Sleep 500 lngR = SendNotifyMessage(PWnd, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(cWnd), BN_CLICKED), ByVal cWnd) If lngR = 0 Then Exit Do Loop Do Sleep 1 hDlg1 = FindWindow("#32770", "名前を付けて保存") If hDlg1 Then Exit Do Loop hWnd1 = GetDlgItem(hDlg1, 1148) 'ファイル名 If hWnd1 = 0 Then Exit Sub hWnd2 = GetDlgItem(hDlg1, 1) '保存(&S) If hWnd2 = 0 Then Exit Sub nLen = SendMessage(hWnd1, WM_GETTEXTLENGTH, 0, ByVal 0&) + 1 strBuf = String$(nLen, 0) lngR = SendMessage(hWnd1, WM_GETTEXT, nLen, ByVal strBuf) strBuf = Left$(strBuf, InStr(strBuf, vbNullChar) - 1) strA = "D:\" & strBuf 'Full Path 指定 lngR = SendMessage(hWnd1, WM_SETTEXT, 0, ByVal strA) lngR = PostMessage(hDlg1, WM_COMMAND, MAKEWPARAM(1, BN_CLICKED), ByVal hWnd2) Do Sleep 1 hDlg2 = FindWindow("#32770", "ダウンロードの完了") If hDlg2 Then Exit Do Loop hWnd3 = GetDlgItem(hDlg2, 2) If hWnd3 = 0 Then Exit Sub lngR = PostMessage(hDlg2, WM_COMMAND, MAKEWPARAM(2, BN_CLICKED), ByVal hWnd3) End Sub
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.