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

Create a system tray icon and a dialog for a Windows Service

, 25 Jan 2008 CPOL
This article shows how to create a system tray icon and a dialog for a Windows Service.
bin.zip
Interop.SensEvents.dll
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.vshost.exe
Interop.COMAdmin.dll
binary.zip
Interop.SensEvents.dll
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.vshost.exe
Interop.COMAdmin.dll
source.zip
SystemTrayIconInSvc.csproj.user
SystemTrayIconInSvc.suo
obj
Debug
Interop.COMAdmin.dll
Interop.SensEvents.dll
Refactor
SystemTrayIconInSvc.csproj.GenerateResource.Cache
SystemTrayIconInSvc.csproj.ResolveComReference.cache
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.pdb
SystemTrayIconInSvc.SettingDlg.resources
TempPE
Release
Interop.COMAdmin.dll
Interop.SensEvents.dll
SystemTrayIconInSvc.csproj.GenerateResource.Cache
SystemTrayIconInSvc.csproj.ResolveComReference.cache
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.pdb
SystemTrayIconInSvc.SettingDlg.resources
TempPE
Properties
SourceAndBinary.zip
SystemTrayIconInSvc.csproj.user
bin
Release
Interop.COMAdmin.dll
Interop.SensEvents.dll
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.vshost.exe
sourcecode.zip
SystemTrayIconInSvc.csproj.user
SystemTrayIconInSvc.suo
Interop.COMAdmin.dll
Interop.SensEvents.dll
SystemTrayIconInSvc.csproj.GenerateResource.Cache
SystemTrayIconInSvc.csproj.ResolveComReference.cache
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.pdb
SystemTrayIconInSvc.SettingDlg.resources
Interop.COMAdmin.dll
Interop.SensEvents.dll
SystemTrayIconInSvc.csproj.GenerateResource.Cache
SystemTrayIconInSvc.csproj.ResolveComReference.cache
SystemTrayIconInSvc.exe
SystemTrayIconInSvc.pdb
SystemTrayIconInSvc.SettingDlg.resources
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{2BD61D7E-FA7A-4B1B-9050-04EEE68A8765}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SystemTrayIconInSvc</RootNamespace>
    <AssemblyName>SystemTrayIconInSvc</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Configuration.Install" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.ServiceProcess" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Desktop.cs" />
    <Compile Include="SensAdvisor.cs" />
    <Compile Include="SettingDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="SettingDlg.Designer.cs">
      <DependentUpon>SettingDlg.cs</DependentUpon>
    </Compile>
    <Compile Include="Svc.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Svc.Designer.cs">
      <DependentUpon>Svc.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="SvcInstaller.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="User32DLL.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="install.bat">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Include="uninstall.bat">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <COMReference Include="COMAdmin">
      <Guid>{F618C513-DFB8-11D1-A2CF-00805FC79235}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
    </COMReference>
    <COMReference Include="SensEvents">
      <Guid>{D597DEED-5B9F-11D1-8DD2-00AA004ABD5E}</Guid>
      <VersionMajor>2</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
    </COMReference>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SettingDlg.resx">
      <DependentUpon>SettingDlg.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

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

Jerry.Wang
Team Leader
China China
Jerry is from China. He was captivated by computer programming since 13 years old when first time played with Q-Basic.
 

  • Windows / Linux & C++
  • iOS & Obj-C
  • .Net & C#
  • Flex/Flash & ActionScript
  • HTML / CSS / Javascript
  • Gaming Server programming / video, audio processing / image & graphics
 
Contact: vcer(at)qq.com
Chinese Blog: http://blog.csdn.net/wangjia184

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 25 Jan 2008
Article Copyright 2008 by Jerry.Wang
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid