How can check with C# if Microsoft Outlook is already open? -
i have tried looking answer question... forgive me if have overlooked it.
what trying automate sending email. have want in code code assumes outlook not open.
is there way me test if outlook open before opens instance of outlook?
microsoft.win32.registrykey key = microsoft.win32.registry.localmachine.opensubkey("software\\microsoft\\windows\\currentversion\\app paths\\outlook.exe"); string path = (string)key.getvalue("path"); if (path != null) system.diagnostics.process.start("outlook.exe"); else messagebox.show("there no outlook in computer!", "systemerror", messageboxbuttons.ok, messageboxicon.exclamation);
int proccount = 0; process[] processlist = process.getprocessesbyname("outlook"); foreach (process theprocess in processlist) { proccount++; } if (proccount > 0) { //outlook open }
Comments
Post a Comment