I am just using this test code to make sure I have the principal right but have hit problems straight away.
Dim RunningProcesses() As Process
RunningProcesses = Process.GetProcesses
For Each instance As Process In RunningProcesses
instance.Refresh()
If instance.ProcessName.Contains("Heating Viewer") Then
ListBox1.Items.Add(instance.ProcessName)
ListBox1.Items.Add(instance.MainWindowTitle)
End If
Next
I wrote this last night and on first run it worked ok. When i closed "Heating Viewer.exe" it stopped adding to the listbox as expected but when I start "Heating Viewer.exe" again it finds the process name but not the MainWindow Title ? and no matter how many times I ran this code it never finds the MainWindowTitle again?
I checked Process class on MSDN and read about the cache so I added the refresh command as suggested but this makes no difference.
On running it for first time this morning after a reboot it worked for the first time again but then same as last night.
I just re-started VS 2012 to see if that would make a difference but even the first run found the processname but not the mainwindowTitle
Can anyone tell me what I am doing wrong please?
Thanks
Mike

New Topic/Question
Reply




MultiQuote






|