Click to Rate and Give Feedback
MSDN
MSDN Library
COM+ Reference
ICOMAdminCatalog2
 ICOMAdminCatalog2::CreateServiceFor...

  Switch on low bandwidth view
COM+ (Component Services)
ICOMAdminCatalog2::CreateServiceForApplication

The CreateServiceForApplication method creates an NT service associated with the specified COM+ application.

A service created by this method can be removed using the DeleteServiceForApplication method.

HRESULT CreateServiceForApplication(
  BSTR bstrApplicationIDOrName,
  BSTR bstrServiceName,
  BSTR bstrStartType,
  BSTR bstrErrorControl,
  BSTR bstrDependencies,
  BSTR bstrRunAs,
  BSTR bstrPassword,
  VARIANT_BOOL bDesktopOk
);
bstrApplicationIDOrName
[in] The application ID or name of the application.

bstrServiceName
[in] Service name of the application. This name is the internal name used by the NT SCM, not the display name.

bstrStartType
[in] Specifies when to start the service. The valid arguments are the options of the dwStartType parameter of the CreateService function. The arguments must be in quotes. The following are the valid arguments: SERVICE_BOOT_START, SERVICE_SYSTEM_START, SERVICE_AUTO_START, SERVICE_DEMAND_START, and SERVICE_DISABLED.

bstrErrorControl
[in] Specifies the severity of the error if this service fails to start during startup. The error determines the action taken by the startup program if failure occurs. The valid arguments are the options of the dwErrorControl parameter of the CreateService function. The arguments must be in quotes. The following are the valid arguments: SERVICE_ERROR_IGNORE, SERVICE_ERROR_NORMAL, SERVICE_ERROR_SEVERE, and SERVICE_ERROR_CRITICAL.

bstrDependencies
[in] A list of dependencies for the service. There are two possible formats for the string: a standard null-delimited, double-null-terminated string (exactly as documented for CreateService); or a script-friendly list of service names separated by "\" (an invalid character to have in a service name). The rpcss service is implicit in this parameter and does not need to be specified.

bstrRunAs
[in] The user name to run this service as. This may be NULL to indicate that it should run as Local Service.

bstrPassword
[in] The password for the system user account. This must be NULL if the service is configured to run as Local Service.

bDesktopOk
[in] Indicates whether or not the service should be allowed to interact with the desktop. This parameter is valid only when the service is marked as Local Service and must be FALSE otherwise.

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK
Method completed successfully.

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows XP, Windows Server 2003

Header: Declared in comadmin.h

Library: Included as a resource in comadmin.dll

Send comments about this topic to Microsoft.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker