Enumerating ShellWindows in windows Service

Posted on 2009-04-28
Last Modified: 2013-11-26

I'm working on a windows service in which I need to interact with the desktop and control a browser instance. I've come across ShellWindows (from SHDocVw) in which I can enumerate sucessfully in a widows Forms Application to obtain the handle of the Intenet Explorer Browser.

The functionality I'm using is:-

   For Each window As InternetExplorer In New ShellWindows
   Next window

We need to migrate this funcitonality into a Windows service so that the processing can occur in the background and then on a given event the windows service will interact with the desktop
and then control the active Internet explorer instance.

However, when I try the code in the windows Service I get an error:-
System.IO.FileNotFoundException: The system cannot find the file specified.
   at MyService.PopBrowser.GetWindowsAndPop()

I have attempted to run the service by allowing "Allow Service to interact with desktop" in the Log On section and even using the specific account that I'm logged in on but it always gives the above error.

I know that the widows service isn't designed to cater for interacting directly with desktop processes but is there a way to make this work? It's not really an option to code any windows Form type application (i.e. such as to have a second application which will communicate with the service).

Many thanks


Many Thanks
Question by:mikesung99
    LVL 23

    Assisted Solution

    With no sample code, it's all a guess.

    My first guess is a pathing problem.  Check the default directory and see if it's not system32.

    Accepted Solution


    I've Put the Dll explicitly into system32 and tried to run it again but it gives the same result


    LVL 23

    Expert Comment

    and what's the code that throws the exception?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now