Click here to Skip to main content
15,881,852 members
Articles / Desktop Programming / Windows Forms

Windows Vista aware NT Service interacting with the desktop

Rate me:
Please Sign up or sign in to vote.
4.90/5 (30 votes)
27 Mar 200735 min read 132.9K   1.4K   103  
How to build Windows Vista aware Windows NT Service which can interact with the user
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<configSections>
		<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
			<section name="WindowsNTService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
		</sectionGroup>
	</configSections>
 <appSettings>
		<add key="ProcessesToWatch" value="iexplore,msnmsgr,firefox"/>
		<add key="DailyCredit" value="150"/>
		<add key="LogName" value="StefanoLog"/>
		<add key="SourceName" value="ProgramWatcher"/>
		<add key="DaysToWatch" value="1,2,3,4,5,6"/>
		<add key="LockedTimeSpans" value="21,24"/>
		<add key="UsersToWatch" value="kid1,kid2,kid3"/>
	</appSettings>
 <userSettings>
  <WindowsNTService.Properties.Settings>
   <setting name="timestamp" serializeAs="String">
    <value />
   </setting>
  </WindowsNTService.Properties.Settings>
 </userSettings>
	<system.serviceModel>
		<services>
			<service name="WindowsNTService.WCFServiceClass"
      behaviorConfiguration="NTBehavior">
				<host>
					<baseAddresses>
						<add baseAddress="http://localhost:9002/NTWatcherService/"/>				   
					</baseAddresses>						
				</host>
				<endpoint name="WindowsNTService"
       address="net.pipe://localhost/NTWatcherService/pipe"
       binding="netNamedPipeBinding"
       bindingConfiguration="NTPipeConfiguration"
       contract="WindowsNTService.IWCFServiceClass"/>
			</service>		  
		</services>
		<bindings>
			<netNamedPipeBinding>
				<binding name="NTPipeConfiguration"></binding>
			</netNamedPipeBinding>
		</bindings>
		<behaviors>
			<serviceBehaviors>
				<behavior name="NTBehavior">
					<serviceMetadata httpGetEnabled="true" />
				</behavior>
			</serviceBehaviors>
		</behaviors>
	</system.serviceModel>
</configuration>

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Europe Europe
I started my professional career learning FORTRAN in 1979. Later I graduated Master of Science in power engineering and wrote assembly language programs in the mid 80s in order to control huge and heavy equipments at a hydro power station on the Danube River. Next I graduated PhD in control engineering. At that time I spent long nights to learn and practice both Basic- and C languages on my precious Atari ST. Do you remember the classical book from Ritchie and Kernighan? In the 90s I used Visual C++ working for the Vienna City Government. In the new millennium I joined Microsoft, passed exams for MCAD and now I’m working as consultant serving for software developers in Austria. Please take a note, my articles are not checked by the product teams, therefore they are reflecting just my personal experience.

Comments and Discussions