tags:

views:

101

answers:

1

Using the below code, I can retrieve the image name and process ID of the DOS command window on a remote machine, but can I also retrieve the DOS window title?

    Dim current As Process = Process.GetCurrentProcess()
    Dim processes As Process() = Process.GetProcesses("REMOTE_COMPUTER")

    Dim ThisProcess As Process
    For Each ThisProcess In processes
        If ThisProcess.ProcessName.ToUpper.Contains("CMD") Then
            ListBox1.Items.Add("Process Name: " & ThisProcess.ProcessName & vbTab & "Process ID: " & ThisProcess.Id)
        End If
    Next
A: 

Try this:

ThisProcess.MainWindowTitle

I was playing with GetWindowText from user32.dll and was looking for a Process property to get main window handler, so i stumbled with that MainWindowTitle property

Sometimes, it doesn't need to be hard.

Rubens Farias
Thanks, this works great on my local machine, but I need to access the processes on a remote machine. Unfortunately the MainWindowTitle property isn't supported when you are using it on a remote machine. Any ideas?
stewdaddy5000
Sorry, but probably no: "So the answer from Microsoft is that this change was intentional due to an internal change in how the data is collected, but they mistakenly did not update the documentation to reflect."http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic57776.aspx
Rubens Farias