windows-services

Allow service to interact with desktop in Windows

被刻印的时光 ゝ 提交于 2019-11-26 00:44:14
问题 In services.msc > Action > Properties > Log On > Allow service to interact with desktop, I enabled my service to interact with the desktop. What does it mean exactly? How can I use it to play sound (MP3, WAV, etc.) from my service? 回答1: I'm going to take some liberties in here in trying to interpret your question from keywords. In the future, please spend more time writing your questions so that they make sense to another person who is trying to read and understand them. There is a checkbox

How can a Windows service execute a GUI application?

♀尐吖头ヾ 提交于 2019-11-26 00:43:14
问题 I have written a Windows service that allows me to remotely run and stop applications. These applications are run using CreateProcess, and this works for me because most of them only perform backend processing. Recently, I need to run applications that present GUI to the current log in user. How do I code in C++ to allow my service to locate the currently active desktop and run the GUI on it? 回答1: Roger Lipscombe's answer, to use WTSEnumerateSessions to find the right desktop, then

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154

。_饼干妹妹 提交于 2019-11-26 00:27:23
问题 I developed a Windows service using C#.NET to generate PDF report. To generate PDF file I am using a third party dll. The application is running in my Windows XP platform. When I deployed the service in Windows Server 2008 64 bit version, I got this error: Retrieving the COM class factory for component with CLSID {46521B1F-0A5B-4871-A4C2-FD5C9276F4C6} failed due to the following error: 80040154. I registered the DLL using the regsvr32 command. I able to see this CLSID in the registry. But the

How to make a .NET Windows Service start right after the installation?

半城伤御伤魂 提交于 2019-11-26 00:15:04
问题 Besides the service.StartType = ServiceStartMode.Automatic my service does not start after installation Solution Inserted this code on my ProjectInstaller protected override void OnAfterInstall(System.Collections.IDictionary savedState) { base.OnAfterInstall(savedState); using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) serviceController.Start(); } Thanks to ScottTx and Francis B. 回答1: You can do this all from within your

Windows service NOT shown in add remove programs under control panel

百般思念 提交于 2019-11-25 23:57:37
问题 I installed my windows service via (name of the service: Testing Service) InstallUtil.exe present in .NET Framework (:\\Windows\\Microsoft.NET\\FrameWork64\\v4) in a windows 7 computer. I can see my service under services console. However, i went to programs and features of control panel to manually uninstall the same service, i didn\'t see my services under programs and features? Any thoughts why a service will not be shown, so that, user can uninstall it? I checked the show hidden files too

Easier way to debug a Windows service

为君一笑 提交于 2019-11-25 23:47:55
问题 Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It\'s kind of cumbersome and I\'m wondering if there is a more straightforward approach. 回答1: If I want to quickly debug the service, I just drop in a Debugger.Break() in there. When that line is reached, it will drop me back to VS. Don't forget to remove that line when you are done. UPDATE: As an alternative to #if DEBUG pragmas,

Best Timer for using in a Windows service

可紊 提交于 2019-11-25 23:30:03
问题 I need to create some windows service which will execute every N period of time. The question is: Which timer control should I use: System.Timers.Timer or System.Threading.Timer one? Does it influence on something? I am asking because I heard many evidences to non correct work of System.Timers.Timer in windows services. Thank you. 回答1: Both System.Timers.Timer and System.Threading.Timer will work for services. The timers you want to avoid are System.Web.UI.Timer and System.Windows.Forms.Timer

Elevating process privilege programmatically?

让人想犯罪 __ 提交于 2019-11-25 22:57:42
问题 I\'m trying to install a service using InstallUtil.exe but invoked through Process.Start . Here\'s the code: ProcessStartInfo startInfo = new ProcessStartInfo (m_strInstallUtil, strExePath); System.Diagnostics.Process.Start (startInfo); where m_strInstallUtil is the fully qualified path and exe to \"InstallUtil.exe\" and strExePath is the fully qualified path/name to my service. Running the command line syntax from an elevated command prompt works; running from my app (using the above code)

Easiest language for creating a Windows service

北战南征 提交于 2019-11-25 22:43:22
问题 What is the easiest language to build Windows services in? Easiest in this case would be defined as least amount of code, and lowest point of entry into the language. 回答1: At the risk of stating the obvious, if you have any C/C++/Java background, I think C# offers you the lowest point of entry. Assuming you're using Visual Studio 2008, you can follow these steps: Open Visual Studio 2008, and select the File|New|Project menu option. In the New Project dialog... Select the Visual C#|Windows

How to create a windows service from java app

拟墨画扇 提交于 2019-11-25 22:38:49
问题 I\'ve just inherited a java application that needs to be installed as a service on XP and vista. It\'s been about 8 years since I\'ve used windows in any form and I\'ve never had to create a service, let alone from something like a java app (I\'ve got a jar for the app and a single dependency jar - log4j). What is the magic necessary to make this run as a service? I\'ve got the source, so code modifications, though preferably avoided, are possible. 回答1: I've had some luck with the Java