Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 536629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:50:31+00:00 2026-05-13T09:50:31+00:00

I have created an windows service. I want to open some windows based application

  • 0

I have created an windows service. I want to open some windows based application from this service.

But my windows service is unable to start desktop applications. To enable the access I had to do the following steps:

  1. Opened the administrative tool “Services”

  2. Right clicked on my service and had to select “properties”

  3. Then in the “Log On” tab, selected “Allow service to interact with desktop”.

After that my service can open desired windows based processes.

Can I configure my windows service in the code (C#) to access the desktop so that I won’t have to change the access permission manually after installation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:50:32+00:00Added an answer on May 13, 2026 at 9:50 am

    In .NET you can override the OnCommited method of the service installer class to configure the service to access the desktop. The code will look as follows:

    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        private ServiceProcessInstaller serviceProcessInstaller;
        private ServiceInstaller serviceInstaller;
    
        public ProjectInstaller()
        {
            InitializeComponent();
    
            // adjust configuration to whatever is needed
            serviceInstaller = new ServiceInstaller();
            serviceInstaller.ServiceName = "My Service";
            serviceInstaller.DisplayName = "My Service";
            serviceInstaller.StartType = ServiceStartMode.Manual;
            this.Installers.Add(serviceInstaller);
    
            serviceProcessInstaller = new ServiceProcessInstaller();
            serviceProcessInstaller.Account = 
                System.ServiceProcess.ServiceAccount.LocalSystem;
            serviceProcessInstaller.Password = null;
            serviceProcessInstaller.Username = null;
            this.Installers.Add(serviceProcessInstaller);
        }
    
        protected override void OnCommitted(IDictionary savedState)
        {
            base.OnCommitted(savedState);
    
            // The following code sets the flag to allow desktop interaction 
            // for the service
            //
            using (RegistryKey ckey = 
                Registry.LocalMachine.OpenSubKey(
                    @"SYSTEM\CurrentControlSet\Services\My Service", true))
            {
                if (ckey != null && ckey.GetValue("Type") != null)
                {
                    ckey.SetValue("Type", (((int)ckey.GetValue("Type")) | 256));
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to start a windows service which I have created from another windows
I have a WCF Windows service with an endpoint specified in the config file
I have used an open source code from CodeProject to read email from incoming
I created a service which I now want to install to test, I created
I need some help about WCF and authorization. Currently I have a client which
I'm doing some quick Java-.NET interop and have decided on POX with WCF. However,
I have a web service which allows the users to upload and keep track
I'm writing a web application in Python, intended for use by teachers and pupils
I am new to WCF services. I have been working with WCF for over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.