Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
AnswerRe: Text effects using GDI... Pin
Pete O'Hanlon13-Apr-07 3:02
mvePete O'Hanlon13-Apr-07 3:02 
GeneralRe: Text effects using GDI... Pin
Ravikumar Patra13-Apr-07 3:09
professionalRavikumar Patra13-Apr-07 3:09 
Questionhow to get Coloumns counts of ListView using SendMessage() Pin
Farhan Ali13-Apr-07 1:32
Farhan Ali13-Apr-07 1:32 
QuestionWrong forum? Pin
CPallini13-Apr-07 2:22
mveCPallini13-Apr-07 2:22 
AnswerRe: Wrong forum? Pin
Farhan Ali13-Apr-07 2:25
Farhan Ali13-Apr-07 2:25 
GeneralRe: Wrong forum? Pin
CPallini13-Apr-07 2:54
mveCPallini13-Apr-07 2:54 
GeneralRe: Wrong forum? Pin
Farhan Ali13-Apr-07 19:32
Farhan Ali13-Apr-07 19:32 
QuestionBackgroundWorker and STA threading model ? Pin
Christian Graus13-Apr-07 0:53
protectorChristian Graus13-Apr-07 0:53 
AnswerRe: BackgroundWorker and STA threading model ? Pin
Pete O'Hanlon13-Apr-07 0:56
mvePete O'Hanlon13-Apr-07 0:56 
GeneralRe: BackgroundWorker and STA threading model ? Pin
Christian Graus13-Apr-07 1:27
protectorChristian Graus13-Apr-07 1:27 
GeneralRe: BackgroundWorker and STA threading model ? Pin
Pete O'Hanlon13-Apr-07 1:41
mvePete O'Hanlon13-Apr-07 1:41 
GeneralRe: BackgroundWorker and STA threading model ? Pin
Christian Graus13-Apr-07 10:59
protectorChristian Graus13-Apr-07 10:59 
GeneralRe: BackgroundWorker and STA threading model ? Pin
Pete O'Hanlon15-Apr-07 9:18
mvePete O'Hanlon15-Apr-07 9:18 
Questionregioning, drag'n'drop & saving drafts Pin
xtremetechnology13-Apr-07 0:43
xtremetechnology13-Apr-07 0:43 
QuestionDetect system shutdown Pin
Bob Stanneveld13-Apr-07 0:11
Bob Stanneveld13-Apr-07 0:11 
AnswerRe: Detect system shutdown Pin
originSH13-Apr-07 0:17
originSH13-Apr-07 0:17 
AnswerRe: Detect system shutdown Pin
lucjon13-Apr-07 0:35
lucjon13-Apr-07 0:35 
GeneralRe: Detect system shutdown Pin
Bob Stanneveld13-Apr-07 1:02
Bob Stanneveld13-Apr-07 1:02 
AnswerRe: Detect system shutdown Pin
Dave Kreskowiak13-Apr-07 8:11
mveDave Kreskowiak13-Apr-07 8:11 
AnswerRe: Detect system shutdown Pin
Jupiter913-Apr-07 11:17
Jupiter913-Apr-07 11:17 
One trick is to make the services dependent on the monitoring service. Then on the service OnStart, set the shutdown priority for the monitoring service to a high priority to guarantee everything happens in the correct sequence. This can be done via:
NOTE: the SHUTDOWN_LEVEL is set at the minimum user-level available priority to set the service at the top most spot of the list.

using System.Runtime.InteropServices;

[DllImport("Kernel32.DLL")]
private static extern bool SetProcessShutdownParameters(Int32 dwLevel, Int32 dwFlags);
private const Int32 SHUTDOWN_NORETRY = 0x00000001;
private const Int32 SHUTDOWN_LEVEL = 0x281;

protected override void OnStart(string[] args)
{
if (!SetProcessShutdownParameters(SHUTDOWN_LEVEL, SHUTDOWN_NORETRY))
System.Diagnostics.Debug("Failed to set shutdown priority.");
}

However, if the service monitor is simply acting as a recovery app, then using the service recovery options may be more optimal to allow windows service manager to automatically restart the service for you.
QuestionRe: Detect system shutdown Pin
Bob Stanneveld16-Apr-07 1:36
Bob Stanneveld16-Apr-07 1:36 
QuestionSmiley icon to be displayed in listbox. Pin
Nekshan12-Apr-07 23:57
Nekshan12-Apr-07 23:57 
AnswerRe: Smiley icon to be displayed in listbox. Pin
Christian Graus13-Apr-07 0:00
protectorChristian Graus13-Apr-07 0:00 
GeneralRe: Smiley icon to be displayed in listbox. Pin
Luc Pattyn13-Apr-07 1:54
sitebuilderLuc Pattyn13-Apr-07 1:54 
GeneralRe: Smiley icon to be displayed in listbox. Pin
Christian Graus13-Apr-07 10:54
protectorChristian Graus13-Apr-07 10:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.