ksor
Active member
- Joined
- Jul 4, 2019
- Messages
- 33
- Programming Experience
- 10+
I've made a console program to run by the scheduler every sunday to copy my Outlook mail file.
If Outlook runs, the program stops it, do the copying and starts Outlook again and send a mail with the result of the copying.
It works nicely but lately I've had a problem on ONE single machine - when Outlook starts up again it's IN-visible - the user then ofcause starts Outlook manually and then 2 instances are running.
Not that it matters that 2 instances runs ... but why is it invisible ?
I use this essential snippet of code to start Outlook again:
If Outlook runs, the program stops it, do the copying and starts Outlook again and send a mail with the result of the copying.
It works nicely but lately I've had a problem on ONE single machine - when Outlook starts up again it's IN-visible - the user then ofcause starts Outlook manually and then 2 instances are running.
Not that it matters that 2 instances runs ... but why is it invisible ?
I use this essential snippet of code to start Outlook again:
Starting Outlook:
else if (args[0].ToUpper()=="START") {
ProcessStartInfo startInfo = new ProcessStartInfo("Outlook.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
}
else if (args[0].ToUpper()=="GO") {
if (ThisIsRunning("Outlook")) {
StopExecutionOf("Outlook");
}
// Her testes på OM ALLE parametre ER angivet !
if ((Properties.Settings.Default.Datafil.ToString()=="") |
(Properties.Settings.Default.SikkMappe.ToString()=="") |
(Properties.Settings.Default.Modtager.ToString()=="") |
(Properties.Settings.Default.Bruger.ToString()=="") |
(Properties.Settings.Default.Password.ToString()=="")){
handleParams();
}
else{
File.Copy(Properties.Settings.Default.Datafil.ToString(), Properties.Settings.Default.SikkMappe.ToString(), true);
sendMail(Properties.Settings.Default.Modtager.ToString(), txtSuccess);
ProcessStartInfo startInfo = new ProcessStartInfo("Outlook.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
}
}
else {
args=null;
ShowWindow(handle, SW_SHOW);
someThingWrong();
}