Question Process.MainWindowTitle returns empty for service

Developer111

Member
Joined
Apr 21, 2010
Messages
24
Programming Experience
5-10
Hi,

I have developed a Windows Service in VB.Net (VS2010) which is running on Windows7. I am trying to get “MainWindowTitle” but it returns empty.

lObj_Process = Process.GetProcessById(Pi_ProcessID)
lObj_Process.MainWindowTitle

If same service runs on Windows XP, title is found.

Moreover if I use the same code in windows application rather than service then it returns proper title.

Please note that Service is reading/writing files so there should be no privileges issue.

Question:

Why “MainWindowTitle” property works fine for windows application but returns empty if used in Windows Service.

Regards,
Immi
 
Services is not supposed to have any GUI, so there should be no windows.
 
Thanks for reply,

You are right Service has no GUI, Infact i want to get windows title of the other processes running on the local machine. Those processes are windows applications having GUI. Service is getting Process IDs successfully and also get the Process Name as well using

lObj_Process.ProcessName

Hope above explanation will clear the confusion.
 
I misunderstood the question, I thought you meant MainWindowTitle was empty for a service process.
Services are also isolated from the interactive desktop, so they are not meant to interact with such in any way other than through IPC.

Thread moved to Windows Services forum.
 

Latest posts

Back
Top