Home All Groups Group Topic Archive Search About

why cant i enumerate shell windows in a windows service

Author
13 Jan 2005 1:05 PM
Misbah Arefin
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 : mare***@enpointe.com
www.enpointe.com

Author
13 Jan 2005 1:19 PM
Misbah Arefin
I even tried cerating a process with CreateProcessWithLogon and
CreateProcessWithToken but still i cannot enumerate shell windows... need
help fast guys

Show quote
"Misbah Arefin" wrote:

> 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 : mare***@enpointe.com
> www.enpointe.com
>
>
Author
15 Jan 2005 8:36 PM
Richard Grimes [MVP]
Misbah Arefin wrote:
> I even tried cerating a process with CreateProcessWithLogon and
> CreateProcessWithToken but still i cannot enumerate shell windows...
> need help fast guys
>
>> 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??

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
--
www.richardgrimes.com
my email evpun***@zicf.bet is encrypted with ROT13 (www.rot13.org)

AddThis Social Bookmark Button