?
Solved

ServiceController Modifiers?

Posted on 2006-06-24
4
Medium Priority
?
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 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