windows-services

what is invalidate,update methods do in VC++

て烟熏妆下的殇ゞ 提交于 2019-11-30 05:41:45
i have small doubt regarding the window functions in c++. what exactly "invalidate()" function do? what message does it sends?when we need to call this? also what is "update()" function? is "invalidaterect()" works similar to "invalidate()" function?. Thanks CWnd::Invalidate() invalidates the entire client area of a window, which indicates that the area is out of date, and should be repainted. You would typically call this on a control that needs to be redrawn. CWnd::InvalidateRect() invalidates only part of the window. With the Invalidate functions, the WM_PAINT message will posted [ not

Visual Studio has insufficient privileges to debug this process. To debug this process, Visual Studio must be run as an administrator

梦想与她 提交于 2019-11-30 05:39:51
问题 I have developed a windows service and this is service is running on my local computer under my account. When I try to debug this service by attaching this as a process in visual studio 2008 I get “Unable to attach to the process. Visual Studio has insufficient privileges to debug this process. To debug this process, Visual Studio must be run as an administrator.” I have logged in to my system as administrator and so when VS 2008 is launched it is running as administrator not sure why I get

Launching GUI App from Windows Service - Window Does Not Appear

为君一笑 提交于 2019-11-30 05:07:06
问题 I have written a simple windows service which will launch a exe specified in the onstart() method of the service. After starting the service the exe got launched it only presents in the memory but it doesnt show in the explorer. I'm trying to launch a calc.exe from my code.it shows the exe in the memory but it doesnt comes into my view(i.e) in the explorer. Below is my code to launch the exe in the onStart() method Process pr=new Process(); pr.StartInfo.FileName="calc.exe"; pr.StartInfo

Detect if code is running as a service

▼魔方 西西 提交于 2019-11-30 04:23:24
问题 Is there a way for an .NET library to detect whether or not it is being run as a service? My library can be run either way. But when its run as a service, developers need to call an additional method indicating that fact or certain features won't work correctly. I want my library, which handles logging, to write a warning if it is used in a service without that method being called. 回答1: After much searching through intellisense, the debugger, and documentation we weren't able to find anything

How to find windows service exe path

巧了我就是萌 提交于 2019-11-30 04:10:32
I have a windows service and I need to create directory to store some info. The directory path must be relative to the windows service exe file. How can get this exe file path ? You can use AppDomain.CurrentDomain.BaseDirectory Tip: If you want to find startup path of installed windows service, look here from registry . HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ + ServiceName There are keys about windows service To get path for service you can use Management object. ref: https://msdn.microsoft.com/en-us/library/system.management.managementobject(v=vs.110).aspx http://dotnetstep

Update a dll without stopping the service

梦想的初衷 提交于 2019-11-30 03:53:48
I would like to update a dll for a server process without stopping the service. How do I do that? A bit like how asp.net automatically picks up new dlls placed in the bin folder. Asp.Net uses a technique called shadow copy If you copy an updated dll into an application’s bin subdirectory, the ASP.NET runtime recognizes there is new code to execute. Since ASP.NET cannot swap the dll into the existing AppDomain , it starts a new AppDomain. The old application domain is “drain stopped”, that is, existing requests are allowed to finish executing, and once they are all finished the AppDomain can

.Net framework to manage background running processess on seperate machines

爱⌒轻易说出口 提交于 2019-11-30 03:32:47
问题 I am having an asp.mvc application which resides on a server.From this application, I want to start a process which is a bit long-running operation and will be resource intensive operation. So what I want to do is I want to have some user agent like 3 which will be there on 3 machines and this user agent will use resources of their respective machines only. Like in Hadoop we have master nodes and cluster in which tasks are run on the individual cluster and there is 1 master node keeping track

How to create a Windows Service in Powershell for “Network Service” account?

﹥>﹥吖頭↗ 提交于 2019-11-30 03:27:37
I want to create a Windows Service using Powershell. Creating it for a given user is piece of cake. I used this function adapted from here . function ReinstallService1 ($serviceName, $binaryPath, $login, $pass) { Write-Host "installing service" # creating credentials which can be used to run my windows service $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ($login, $secpasswd) # creating widnows service using all provided parameters New-Service -name $serviceName -binaryPathName $binaryPath -displayName $serviceName

Get the computer name in a Windows service?

时光怂恿深爱的人放手 提交于 2019-11-30 03:09:14
问题 In a .NET Windows service (C#), how can I get the computer name? Is this a reliable method, or should I wrap it in a try/catch? 回答1: Look at the Environment class. There're lots of nice things in there, including the MachineName: string CurrentMachineName = Environment.MachineName; According to the docs, this could generate an InvalidOperationException so you'll need to be aware of that possibility. The risk probably doesn't warrant wrapping it in a try/catch, though. 回答2: I think first you

C# Windows Service Main Method

六眼飞鱼酱① 提交于 2019-11-30 02:09:44
问题 I'm curious how exactly the Main() method works in a windows service as it relates to the Service Control Manager. When is it executed? How does it hook into the OS? Is it executed when a service is installed? I know it is executed when OnStart() is called by the SCM, OnStop() it's already running so we wouldn't execute it again. If anyone knows a lot about this area and can elaborate I would appreciate it. I am an expeirenced programmer, I don't need a description of what the Main Method