Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Check if outlook is already running

Geek News

Check if outlook is already running
Yael 5/28/2007 12:11:00 PM
How can I check from C# code if outlook program is already running?
if not, I run outlook with:
System.Diagnostics.Process.Start("OUTLOOK.EXE");
Re: Check if outlook is already running
pascal.groulx[ at ]analystik.ca 5/28/2007 6:56:10 PM
On May 28, 8:11 am, Yael <Y...[ at ]discussions.microsoft.com> wrote:
[Quoted Text]
> How can I check from C# code if outlook program is already running?
> if not, I run outlook with:
> System.Diagnostics.Process.Start("OUTLOOK.EXE");

/// <summary>
/// Determines whether or not Outlook.exe is running on this
computer.
/// </summary>
/// <returns>Running or not</returns>
private bool IsRunning()
{
bool Result = false;

System.Diagnostics.Process[] aProcess =
System.Diagnostics.Process.GetProcesses();
for ( int ProcessIndex =0; ProcessIndex < aProcess.Length ;
ProcessIndex++)
{
if ( aProcess[ProcessIndex].ProcessName.ToUpper() == "OUTLOOK" )
{
Result = true;
break;
}
}

return Result;
}

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net