Click here to Skip to main content
15,921,351 members
Home / Discussions / C#
   

C#

 
GeneralHELP! Web secuirty ... Pin
mrwonkothesane424-Jan-05 11:38
mrwonkothesane424-Jan-05 11:38 
GeneralReplacing text Pin
Christer Claesson4-Jan-05 11:35
Christer Claesson4-Jan-05 11:35 
GeneralSpecial Keyboard keys Pin
BertGo4-Jan-05 10:25
BertGo4-Jan-05 10:25 
GeneralRe: Special Keyboard keys Pin
Heath Stewart4-Jan-05 11:12
protectorHeath Stewart4-Jan-05 11:12 
GeneralRe: Special Keyboard keys Pin
BertGo4-Jan-05 13:00
BertGo4-Jan-05 13:00 
GeneralRe: Special Keyboard keys Pin
Heath Stewart4-Jan-05 13:29
protectorHeath Stewart4-Jan-05 13:29 
Generalstopping service via WMI Pin
thespiff4-Jan-05 8:36
thespiff4-Jan-05 8:36 
GeneralRe: stopping service via WMI Pin
Heath Stewart4-Jan-05 10:51
protectorHeath Stewart4-Jan-05 10:51 
The service control manager (SCM) handles querying for dependent services and stopping them. What you see in the user interface is different than what happens. When you stop a service the SERVICE_CONTROL_STOP message is sent to the service's Handler or HandlerEx control handlers (this is true with the ServiceBase class, which encapsulates the native functionality). So, you're right, the code when the service is stopped is the same.

But the code that stops a service is different. The Services snap-in for MMC queries the service for dependent services first, then - if you click "Yes" - stops each one, querying those for dependent services. Finally, the select service is stopped.

You would need to do the same in your code. See http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_tasks__services.asp[^] for examples of how to determine the dependent services (at the bottom). You'll find some other useful examples of queries to use with the ObjectQuery class.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: stopping service via WMI Pin
thespiff5-Jan-05 1:03
thespiff5-Jan-05 1:03 
GeneralRe: stopping service via WMI Pin
Heath Stewart5-Jan-05 4:50
protectorHeath Stewart5-Jan-05 4:50 
GeneralRe: stopping service via WMI Pin
thespiff6-Jan-05 2:19
thespiff6-Jan-05 2:19 
GeneralImplementing mouse panning functionality Pin
Andres Coder4-Jan-05 7:55
Andres Coder4-Jan-05 7:55 
GeneralRe: Implementing mouse panning functionality Pin
Heath Stewart4-Jan-05 11:30
protectorHeath Stewart4-Jan-05 11:30 
GeneralIs this acceptable practice Pin
Wayne Phipps4-Jan-05 7:54
Wayne Phipps4-Jan-05 7:54 
GeneralRe: Is this acceptable practice Pin
perlmunger4-Jan-05 8:41
perlmunger4-Jan-05 8:41 
QuestionHow To Serialize Multiples Refereces to The Same Object? Pin
fmarcos4-Jan-05 7:18
fmarcos4-Jan-05 7:18 
AnswerRe: How To Serialize Multiples Refereces to The Same Object? Pin
Matt Gerrans4-Jan-05 8:03
Matt Gerrans4-Jan-05 8:03 
GeneralLaunching Forms Dynamically Pin
SignMan3594-Jan-05 6:14
SignMan3594-Jan-05 6:14 
GeneralRe: Launching Forms Dynamically Pin
Nick Parker4-Jan-05 7:23
protectorNick Parker4-Jan-05 7:23 
GeneralRe: Launching Forms Dynamically Pin
SignMan3594-Jan-05 14:28
SignMan3594-Jan-05 14:28 
GeneralRe: Launching Forms Dynamically Pin
Anonymous5-Jan-05 4:01
Anonymous5-Jan-05 4:01 
GeneralRe: Launching Forms Dynamically Pin
SignMan3595-Jan-05 8:34
SignMan3595-Jan-05 8:34 
GeneralRe: Launching Forms Dynamically Pin
Skynyrd6-Jan-05 3:30
Skynyrd6-Jan-05 3:30 
GeneralControlling Scroll bars Pin
Wjousts4-Jan-05 5:32
Wjousts4-Jan-05 5:32 
GeneralDeclaring inherited class objects Pin
MarkBremmer4-Jan-05 5:32
MarkBremmer4-Jan-05 5:32 

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.