Quantcast
Viewing all articles
Browse latest Browse all 18858

Outlook Email new message disables WPF window

This email applications works as expected, however when the new mail message is open, the WPF application window is disabled.  How can I enable the WPF application WHILE the email message window is open?

XAML

<Window x:Class="WpfApplication37.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="200" Width="300"><Grid><Button Content="Click to open Outlook" Name="button1" Click="button1_Click" Margin="61,45,73,78"  /></Grid></Window>

C#

using Outlook = Microsoft.Office.Interop.Outlook;  
namespace WpfApplication37
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

            Outlook.Application objOutlook = new Outlook.Application();
            Outlook.MailItem mic = objOutlook.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;

            mic.To = "abc@gmail.com";
            mic.Subject = "This is the subject...";
            mic.Display(true);
        }
    }
}


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>