Solved

ServiceController Modifiers?

Posted on 2006-06-24
4
213 Views
Last Modified: 2010-07-27
I recently discoved that using the code below in a win app is useless (always returns 'Stopped') if the serviceController modifiers are set to private, da......

         MessageBox.Show(serviceController1.Status.ToString());

I'm currently using 'Protected'.....................


Q. What is the correct modifer to use for maximum protection yet allow correct return status?


0
Comment
Question by:kvnsdr
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16987095
If you are calling outside of the service, you need public scope.  What kind of protection are you looking for?

Bob
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 16988086
The most without cutting off my nose.

I'm currently using 'Protected' and all works.

0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 16988139
The scope modifier needed depends on where it is called from?  Is this called from inside the service instance?

1) 'private' is only visible inside a class
2) 'internal' is only visible within a class, and any other class in an assembly, but not outside.
3) 'protected' with 'static' are visible friend or member function of a derived class.
4) 'protected' without 'static' are visible to friends and inside in a derived class only through a pointer to, reference to, or object of the derived class.
5) 'public' is available everything

It sounds like 'protected' is the best you're gonna get.

Bob
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 16989172
Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
which object should i use (efficiency) 5 46
Achieve json result 2 65
Replace &lt; with < 14 56
Error in script 11 47
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now