Click here to Skip to main content
15,911,030 members
Home / Discussions / C#
   

C#

 
Questionhow to identify the language used by the current opereating windows system? Pin
Seraph_summer6-Jul-08 20:56
Seraph_summer6-Jul-08 20:56 
AnswerRe: how to identify the language used by the current opereating windows system? Pin
stancrm6-Jul-08 21:30
stancrm6-Jul-08 21:30 
Questionhow to connect Oracle[C#] Pin
dibya_20036-Jul-08 20:45
dibya_20036-Jul-08 20:45 
AnswerRe: how to connect Oracle[C#] Pin
N a v a n e e t h6-Jul-08 20:58
N a v a n e e t h6-Jul-08 20:58 
AnswerRe: how to connect Oracle[C#] Pin
anillegal7-Jul-08 2:17
anillegal7-Jul-08 2:17 
QuestionHi how i can check the Service Exist or Not Pin
wasimsharp6-Jul-08 20:40
wasimsharp6-Jul-08 20:40 
AnswerRe: Hi how i can check the Service Exist or Not Pin
stancrm6-Jul-08 21:28
stancrm6-Jul-08 21:28 
AnswerRe: Hi how i can check the Service Exist or Not [modified] Pin
Samer Aburabie7-Jul-08 2:45
Samer Aburabie7-Jul-08 2:45 
In order to check wether your service is exist or not by code not using an installer, you can use the System.Management namespace, in order to do it the following example shall help:

string serviceCaption="My Service Caption";
ManagementObjectSearcher searcher = new ManagementObjectSearcher
    ("SELECT * FROM Win32_Service WHERE Caption = "+"serviceCaption);
            foreach (ManagementObject service in searcher.Get())
            {
               //Service Exist               
            }


or you can use the service name instead, notice that the difference between the caption and the name is that caption is as the full length name (short description) while the name is shorty non-alphanumeric:

string serviceName="MyServiceName";
ManagementObjectSearcher searcher = new ManagementObjectSearcher
    ("SELECT * FROM Win32_Service WHERE Name = "+"serviceName);
            foreach (ManagementObject service in searcher.Get())
            {
               //Service Exist               
            }

Notice again that you should add a reference to the System.Management dll in your project.

Sincerely Samer Abu Rabie

Software Engineer

modified on Monday, July 7, 2008 8:53 AM

QuestionComplete Novice Question Pin
killabyte6-Jul-08 19:56
killabyte6-Jul-08 19:56 
AnswerRe: Complete Novice Question Pin
J a a n s6-Jul-08 21:03
professionalJ a a n s6-Jul-08 21:03 
GeneralRe: Complete Novice Question Pin
killabyte6-Jul-08 22:55
killabyte6-Jul-08 22:55 
QuestionSetup and deployment Pin
D i x y6-Jul-08 19:36
D i x y6-Jul-08 19:36 
AnswerRe: Setup and deployment Pin
stancrm6-Jul-08 20:32
stancrm6-Jul-08 20:32 
QuestionHelp for Crystal Report Pin
psohid6-Jul-08 17:38
psohid6-Jul-08 17:38 
AnswerRe: Help for Crystal Report Pin
Christian Graus6-Jul-08 17:49
protectorChristian Graus6-Jul-08 17:49 
AnswerRe: Help for Crystal Report Pin
D i x y6-Jul-08 18:26
D i x y6-Jul-08 18:26 
QuestionGet All IP Addresses and MAC Addresses Pin
kikijas6-Jul-08 16:38
kikijas6-Jul-08 16:38 
QuestionRe: Get All IP Addresses and MAC Addresses Pin
kikijas7-Jul-08 15:03
kikijas7-Jul-08 15:03 
Questionpath Pin
nelsonpaixao6-Jul-08 13:30
nelsonpaixao6-Jul-08 13:30 
AnswerRe: path Pin
Bram van Kampen6-Jul-08 14:02
Bram van Kampen6-Jul-08 14:02 
QuestionRead Excel Pin
mehrdadc486-Jul-08 9:08
mehrdadc486-Jul-08 9:08 
AnswerRe: Read Excel Pin
Christian Graus6-Jul-08 9:19
protectorChristian Graus6-Jul-08 9:19 
AnswerRe: Read Excel Pin
DaveyM696-Jul-08 9:26
professionalDaveyM696-Jul-08 9:26 
AnswerRe: Read Excel Pin
5do86-Jul-08 16:24
5do86-Jul-08 16:24 
GeneralRe: Read Excel Pin
Christian Graus6-Jul-08 16:40
protectorChristian Graus6-Jul-08 16:40 

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.