I need to get the Main Window title of the processes that are running in my desktop.
I have the following code:
foreach (Process p in Process.GetProcesses())
{
Response.Write(p.Id + " " + p.ProcessName + "_" + p.MainWindowTitle);
}
The problem is that if I run this code as a *.exe
file, I can obtain all the data correctly, but If I run it as a service installed on my desktop, I only get the ID
and the ProcessName
, but the MainWindowTitle
has ""
value.
Can someone help me? How can I fix this issue?