掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
コマンドプロントの終了プロセスを検知するには? (ID:139096)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
いな様 お忙しい所、何度も教えて頂きありがとうございます. いな様のアドバイスから、ウィンドウネイム,IDを取得して監視できるようになりました.(ソースがもしおかしければお教え願いします.とりあえず目的は達成できました.) 本当にありがとうございました。 ’<グーバル宣言> Option Explicit '--------------------------------------------- ' API宣言 '--------------------------------------------- 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 GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Public Declare Function GetWindowPlacement Lib "user32" (ByVal hWnd As Long, lpwndpl As WINDOWPLACEMENT) 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 '--------------------------------------------- ' GetWindowで使用する定数 '--------------------------------------------- Public Const GW_OWNER = 4 '--------------------------------------------- ' GetWindowPlacementで使用する構造体 '--------------------------------------------- Public Type POINTAPI x As Long y As Long End Type Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public Type WINDOWPLACEMENT Length As Long flags As Long showCmd As Long ptMinPosition As POINTAPI ptMaxPosition As POINTAPI rcNormalPosition As RECT End Type '--------------------------------------------- ' コールバック関数 '--------------------------------------------- Public Function EnumWndProc(ByVal hWnd As Long, lParam As Long) As Boolean Dim strWindowName As String * 128 Dim strClassName As String * 128 Dim WPL As WINDOWPLACEMENT Dim lngRet As Long '--------------------------------------------- ' 初期化 '--------------------------------------------- strWindowName = "" strClassName = "" '--------------------------------------------- ' ウィンドウのタイトルを表示する '--------------------------------------------- lngRet = GetWindowText(hWnd, strWindowName, Len(strWindowName)) Call GetClassName(hWnd, strClassName, Len(strClassName)) If IsWindowVisible(hWnd) Then If GetWindow(hWnd, GW_OWNER) = 0 Then If lngRet <> 0 Then If Left(strClassName, 7) <> "Progman" Then WPL.Length = Len(WPL) Call GetWindowPlacement(hWnd, WPL) '--------------------------------------------- ' デバックで出力 '--------------------------------------------- Debug.Print "----------------------------------" Debug.Print "hWnd = " & hWnd Debug.Print "Window Name = " & strWindowName Debug.Print "Class Name = " & strClassName Debug.Print "Left = " & WPL.rcNormalPosition.Left Debug.Print "Top = " & WPL.rcNormalPosition.Top Debug.Print "Right = " & WPL.rcNormalPosition.Right Debug.Print "Bottm = " & WPL.rcNormalPosition.Bottom '--------------------------------------------- ' デバックで出力 '--------------------------------------------- End If End If End If End If EnumWndProc = True End Function ’<フォームローカル> Option Explicit Private Sub Command1_Click() Call EnumWindows(AddressOf EnumWndProc, 0) End Sub
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.