Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>private void ThisAddIn_Startup(object sender, System.EventArgs e) { try { // Assign startup and quit events Application.Startup += new Outlook.ApplicationEvents_11_StartupEventHandler(ApplicationObject_Startup); ((Outlook.ApplicationEvents_11_Event)Application).Quit += new Outlook.ApplicationEvents_11_QuitEventHandler(ApplicationObject_Quit); } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { try { // Remove the startup and quit events Application.Startup -= new Outlook.ApplicationEvents_11_StartupEventHandler(ApplicationObject_Startup); ((Outlook.ApplicationEvents_11_Event)Application).Quit -= new Outlook.ApplicationEvents_11_QuitEventHandler(ApplicationObject_Quit); } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error); } } void ApplicationObject_Startup() { try { // Minimize to taskbar Application.ActiveExplorer().WindowState = Outlook.OlWindowState.olMinimized; } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error); } } void ApplicationObject_Quit() { try { // Restart outlook minimized ProcessStartInfo psiOutlook = new ProcessStartInfo("OUTLOOK.EXE", "/recycle"); psiOutlook.WindowStyle = ProcessWindowStyle.Minimized; Process.Start(psiOutlook); } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error); } } </code></pre> <p>It's not very clean, but this worked for me. It simply starts a new instance of Outlook when you close it and always minimizes Outlook on startup. Major drawback of course is that you can't really close Outlook anymore without first disabling the add-in or killing "outlook.exe" in your task manager. Not the best solution, but it does make sure that you'll never miss an email or calendar reminder because you accidently closed Outlook.</p> <p><strong>EDIT</strong> (10/02/12): I updated the restart outlook part of the code. It now starts outlook.exe with the /recycle switch. This attempts to reload Outlook in an existing window. It also restarts outlook using the minimized window style. This prevents outlook's loading window from appearing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload