Solved

Check if Enterprise Manager is open

Posted on 2006-11-22
2
229 Views
Last Modified: 2013-12-03
Hi,

Is there anyway I could detect if Enterprise Manager is open with c#?
0
Comment
Question by:JakeyCakes
2 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 500 total points
ID: 17995297
Hello

   I made a simple method to check if there's an application running or not, it's based on the application title, so you can use it for any application you would like ;-)

====
bool AppIsRunning(string s)
            {
                  bool Found = false;
                  Process[] ps = Process.GetProcesses();                  
                  foreach(Process p in ps)                  
                        if(p.MainWindowTitle.StartsWith(s))
                        {
                              Found = true;
                              break;
                        }
                        else
                              Found =false;
                  
                  return Found ;
            }

            private void button1_Click(object sender, System.EventArgs e)
            {
            if(AppIsRunning("SQL Server Enterprise Manager"))
                        MessageBox.Show("SQL Server Enterprise Manager is running");
                  else
                        MessageBox.Show("SQL Server Enterprise Manager is not running");
            }


Best Regards
Mohammed Nasman
0
 

Author Comment

by:JakeyCakes
ID: 17995824
Thanks mnasman! The points are yours
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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

840 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