| 
    
     |  | こんにちは 
 Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
 Public Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
 Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
 Public Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
 Public Const GW_OWNER = 4
 Public flg As Boolean
 
 Public Function GetProc(ByVal hWnd As Long, lParam As Long) As Boolean
 Dim sName As String * 128
 Dim ret  As Long
 
 sName = ""
 ret = GetWindowText(hWnd, s, Len(s))
 
 If IsWindowVisible(hWnd) Then
 If GetWindow(hWnd, GW_OWNER) = 0 Then
 If ret <> 0 Then
 If sName Like "対象のWindowキャプション名*" Then
 flg = True
 Exit Function
 End If
 End If
 End If
 End If
 GetProc = True
 End Function
 
 
 Sub test()
 Dim s As Single
 s = Timer
 flg = False
 Do
 Call EnumWindows(AddressOf GetProc, 0)
 If Timer - s > 10 Then '10秒待ち
 Exit Do
 End If
 Loop Until flg = True
 If flg = False Then
 MsgBox "時間切れ、見つかりません"
 Else
 '見つかったので次の処理
 Stop
 End If
 End Sub
 
 こんな感じでどうでしょうか?
 
 
 ▼ちょろすけ さん:
 >皆さま教えて下さい。
 >
 >あるアプリケーションをShellコマンドで起動させて、起動完了(ウインドウが
 >完全に開いた状態)を判定してから次の処理(SendKeysなど)に移りたいの
 >ですが、どの様なコードを書けば良いのか行き詰ってます。
 >
 >(色々調べてみると、アプリケーションを起動させて、終了を確認してから
 > 次の処理に移るようなコードはありましたが、今回は起動完了だけを判定
 > したいです。)
 >
 >Do〜Loopとかでも試してみましたが、Shellコマンドが通った時点(ウインドウが
 >完全に開く前)で次の処理に移ってしまうので、SendKeysなどがうまく動かない
 >のです。
 >
 >長々とすいません、、宜しくお願い致します。
 
 |  |