Use : 1 Label, 2 Textbox, 1 Timer
Code:
Public Class Main
Private Declare Function GetWindowTextLengthA Lib "user32" ( _
ByVal hwnd As IntPtr) As Integer
Private Declare Function GetWindowTextA Lib "user32" ( _
ByVal hwnd As IntPtr, _
ByVal lpString As System.Text.StringBuilder, _
ByVal nMaxCount As Integer) As Integer
Private Function GetText()
Dim processName As Process() = Process.GetProcessesByName(txtProcess.Text)
Dim length As Integer = GetWindowTextLengthA(processName(0).MainWindowHandle)
Dim sb As New System.Text.StringBuilder("", length)
GetWindowTextA(processName(0).MainWindowHandle, sb, sb.Capacity + 1)
Return sb.ToString()
End Function
Private Sub tmrChk_Tick(sender As Object, e As EventArgs) Handles tmrChk.Tick
Dim processName As Process() = Process.GetProcessesByName(txtProcess.Text)
If Not processName.Length = 0 Then
Label1.Text = "Detected: " + txtProcess.Text
Label1.ForeColor = Color.Green
txtGet.Text = GetText()
Else
Label1.Text = "Can not find: " + txtProcess.Text
Label1.ForeColor = Color.Red
txtGet.Text = String.Empty
End If
End Sub
End Class