Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Structures, prefix the name with the module name and a period.
SetServiceStatus (Structures)
.
PER 'Programming Server-Side Applications for Microsoft Windows 2000' ISBN: 0-7356-0753-2
[StructLayout(LayoutKind.Sequential)]
public struct ServiceStatus {
public long dwServiceType;
public ServiceState dwCurrentState;
public long dwControlsAccepted;
public long dwWin32ExitCode;
public long dwServiceSpecificExitCode;
public long dwCheckPoint;
public long dwWaitHint;
};
[DllImport("advapi32.dll")]
private static extern bool SetServiceStatus(IntPtr hServiceStatus, ref ServiceStatus lpServiceStatus);
[StructLayout(LayoutKind.Sequential)]
public struct SERVICE_STATUS {
public long serviceType;
public State currentState;
public long controlsAccepted;
public long win32ExitCode;
public long serviceSpecificExitCode;
public long checkPoint;
public long waitHint;
};
public enum State
{
SERVICE_STOPPED = 0x00000001,
SERVICE_START_PENDING = 0x00000002,
SERVICE_STOP_PENDING = 0x00000003,
SERVICE_RUNNING = 0x00000004,
SERVICE_CONTINUE_PENDING = 0x00000005,
SERVICE_PAUSE_PENDING = 0x00000006,
SERVICE_PAUSED = 0x00000007,
}
Notes:
1) The Microsoft MSDN Site is incorrect in their example for C#! They do not call the lpServiceStatus argument using the ref modifier.
Notes:
2) To have this work on all platforms (64-bit and 32-bit) you must use the IntPtr. Never use an int/Integer as it does not adapt.
1) The Microsoft MSDN Site is incorrect in their example for C#! They do not call the lpServiceStatus argument using the ref modifier.
2) To have this work on all platforms (64-bit and 32-bit) you must use the IntPtr. Never use an int/Integer as it does not adapt.
This API allows you top set the status on a Windows Service. This is especially helpful in .NET in the various events you override from the ServiceBase class. For example, in the OnStart event, here is a recommendatation (see below for a custom enumeration with the SERVICE_START_PENDING and other states):
6/30/2016 9:32:08 AM - Shavais-70.102.219.194
This API allows you top set the status on a Windows Service. This is especially helpful in .NET in the various events you override from the ServiceBase class. For example, in the OnStart event, here is a recommendatation (see below for a custom enumeration with the SERVICE_START_PENDING and other states):
6/30/2016 9:32:08 AM - Shavais-70.102.219.194
This API allows you top set the status on a Windows Service. This is especially helpful in .NET in the various events you override from the ServiceBase class. For example, in the OnStart event, here is a recommendatation (see below for a custom enumeration with the SERVICE_START_PENDING and other states):
6/30/2016 9:32:08 AM - Shavais-70.102.219.194
This API allows you top set the status on a Windows Service. This is especially helpful in .NET in the various events you override from the ServiceBase class. For example, in the OnStart event, here is a recommendatation (see below for a custom enumeration with the SERVICE_START_PENDING and other states):
6/30/2016 9:32:08 AM - Shavais-70.102.219.194
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips?
corrections to the existing content?
alternate definitions?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.