why cant i enumerate shell windows in a windows service

G

Guest

Hi,
Im writing a windows service in C# and I get the following error when trying
to enumerate all shellwindows

"COM object with CLSID {9BA05972-F6A8-11CF-A442-00A0C90A8F39} is either not
valid or not registered."

What could be the problem?? Any solutions??



Regards,

M i s b a h A r e f i n
..NET Programmer
En Pointe Technologies
Reply to : (e-mail address removed)
www.enpointe.com
 
G

Guest

I even tried cerating a process with CreateProcessWithLogon and
CreateProcessWithToken but still i cannot enumerate shell windows... need
help fast guys
 
R

Richard Grimes [MVP]

Misbah said:
I even tried cerating a process with CreateProcessWithLogon and
CreateProcessWithToken but still i cannot enumerate shell windows...
need help fast guys

A service runs under a user other than the interactive user. If you want the
service to get access to the interactive user's desktop then you usually
should not write a service. Let me reiterate: windows services are not
supposed to have user interfaces, nor interact with the user desktop. You
get that error because you are not running the service under a user account.
What account are you using?

If you want to do any interaction with the visible desktop you should write
*two* processes. The service and a process that runs on the user's desktop.
The two should talk using some inter process communication. The second
process can have the code to access the user's desktop and then communicate
that data to the service.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top