コード例 #1
0
ファイル: GwupeService.cs プロジェクト: gwupe/Gwupe
 private static extern bool SetServiceStatus(IntPtr handle, ref ServiceStatus serviceStatus);
コード例 #2
0
ファイル: GwupeService.cs プロジェクト: gwupe/Gwupe
        protected override void OnStart(string[] args)
        {
            WriteEventLog("Starting GwupeService" + BuildMarker);

            // Update the service state to Start Pending.
            ServiceStatus serviceStatus = new ServiceStatus
            {
                dwCurrentState = ServiceState.SERVICE_START_PENDING,
                dwWaitHint = 100000
            };
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            ThreadPool.QueueUserWorkItem(state => BackgroundInit());
            WriteEventLog("Started Background Init Thread for GwupeService" + BuildMarker);

            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }