我试过寻找这个问题的答案......如果我忽略了它,请原谅我.
我想要做的是自动发送电子邮件.我在此代码中拥有我想要的所有内容,但代码假定Outlook未打开.
有没有办法在Outlook打开另一个Outlook实例之前测试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 is no Outlook in this computer!", "SystemError", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Run Code Online (Sandbox Code Playgroud)