Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Monitoring desktop windows from a Windows service

, 2 Jan 2008 CPOL
Capture and save desktop windows from a Windows service.
ScreenMonitor_src.zip
ScreenMonitor
ScreenMonitorLib
Properties
ScreenMonitor
ScreenmonitorService
ScreenmonitorService
SnapShotManager
Properties
Settings.settings
DataSources
ScreenMonitorLib.SnapShotDS+ApplicationsDataTable.datasource
Debug
ScreenMonitorLib.SnapShotDS+SnapShotDataTable.datasource
SnapShotDS.xsc
ScreenMonitorLib
Settings.settings
SnapShotDS.xss
Release
Release
ScreenMonitorLib.SnapShotDS+WndSettingsDataTable.datasource
SetupMonitor
SetupMonitor.vdproj
Properties
Debug
screenmonitor_src2.zip
Settings.settings
ScreenMonitorLib.SnapShotDS+ApplicationsDataTable.datasource
ScreenMonitorLib.SnapShotDS+SnapShotDataTable.datasource
SnapShotDS.xsc
Settings.settings
SnapShotDS.xss
ScreenMonitorLib.SnapShotDS+WndSettingsDataTable.datasource
SetupMonitor.vdproj
SetupMonitor_msi.zip
SetupMonitor.msi
setupmonitor_msi2.zip
SetupMonitor.msi
using System.Collections.Generic;
using System.ServiceProcess;
using System.Text;

namespace ScreenmonitorService
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {


            // More than one user Service may run within the same process. To add
            // another service to this process, change the following line to
            // create a second service object. For example,
            //
            //   ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
            //
            ScreenMonitor sm = new ScreenMonitor();

//#if(DEBUG)

//            // Debug code: this allows the process to run as a non-service.
//            // It will kick off the service start point, but never kill it.
//            // Shut down the debugger to exit
//            sm.StartDebugService();
//            // Put a breakpoint on the following line to always catch
//            // your service when it has finished its work

//            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
//#else
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] { sm};
            ServiceBase.Run(ServicesToRun);
//#endif
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

dmihailescu
Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 2 Jan 2008
Article Copyright 2007 by dmihailescu
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid