示例#1
0
        static public void StartOutlook(ProcessWindowStyle processWindowStyle)
        {
            DebugMessageBox("Before start Outlook process");
            Tracer._Trace("Loading outlook...");
            string path = RegUtil.GetValue(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE", "") as string;

            if (path == null)
            {
                path = "Outlook.exe";
            }
            Tracer._Trace("Trying to start Outlook from path =[" + path + "]");

            Process process = new Process();

            process.StartInfo.FileName        = path;
            process.StartInfo.WindowStyle     = processWindowStyle;
            process.StartInfo.UseShellExecute = false;
            try
            {
                process.Start();
                Tracer._Trace("Outlook from path =[" + path + "] started without exceptions.");
            }
            catch (System.Threading.ThreadAbortException ex)
            {
                Tracer._TraceException(ex);
            }
            catch (Exception exception)
            {
                Tracer._Trace("StartOutlook -- general exception while starting Outlook process:\n" + exception.Message);
                process.StartInfo.UseShellExecute = true;
                process.StartInfo.FileName        = "Outlook.exe";
                process.Start();
            }
            DebugMessageBox("Outlook was started");
        }
示例#2
0
        private static bool IsPickLogonProfile()
        {
            string pickLogonProfile =
                RegUtil.GetValue(Registry.CurrentUser, @"Software\Microsoft\Exchange\Client\Options", "PickLogonProfile") as string;

            if (pickLogonProfile == "1")
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        public static int GetOutlookDefaultEncodingOut()
        {
            if (_outlookVersion == 0)
            {
                return(0);
            }
            string key = @"Software\Microsoft\Office\" + _outlookVersion + @".0\Outlook\Options\MSHTML\International";

            if (!RegUtil.IsKeyExists(Registry.CurrentUser, key))
            {
                return(0);
            }
            return((int)RegUtil.GetValue(Registry.CurrentUser, key, "Default_CodePageOut", 0));
        }
示例#4
0
        public static bool IsDefaultHandler(string protocol)
        {
            Guard.NullArgument(protocol, "protocol");
            string protocolKey = "Software\\Classes\\" + protocol;
            string urlProtocol = RegUtil.GetValue(Registry.CurrentUser, protocolKey, URLProtocol) as string;

            if (urlProtocol != null)
            {
                string command = RegUtil.GetValue(Registry.CurrentUser, protocolKey + SHELL_COMMAND, "") as string;
                if (command != null)
                {
                    return(command.ToLower().IndexOf(Application.ExecutablePath.ToLower()) != -1);
                }
            }
            return(false);
        }
示例#5
0
        private static string GetProfileDir()
        {
            var installDir = RegUtil.GetValue(Registry.LocalMachine, "SOFTWARE\\Miranda", "Install_Dir") as string;

            if (installDir == null)
            {
                return(null);
            }
            installDir = Environment.ExpandEnvironmentVariables(installDir);

            string iniPath = Path.Combine(installDir, "mirandaboot.ini");

            string profileDir = Environment.ExpandEnvironmentVariables(Kernel32Dll.Helpers.GetProfileString(iniPath, "Database", "ProfileDir", ""));

            return(Path.Combine(installDir, profileDir));
        }
示例#6
0
 private static uint GetOutlookVersionFromRegistry()
 {
     if (RegUtil.IsKeyExists(Registry.ClassesRoot, @"Outlook.Application\CurVer"))
     {
         string outlookVersionStr = RegUtil.GetValue(Registry.ClassesRoot, @"Outlook.Application\CurVer", "") as string;
         if (outlookVersionStr != null)
         {
             AddExceptionReportData("\nOutlook version is: " + outlookVersionStr);
             int pos = outlookVersionStr.LastIndexOf('.');
             if (pos >= 0)
             {
                 return(UInt32.Parse(outlookVersionStr.Substring(pos + 1)));
             }
         }
     }
     return(0);
 }
示例#7
0
        private void OnStart(object sender, System.EventArgs e)
        {
            SettingSaver.Save(Controls);
            Settings.LoadSettings();
            string path = RegUtil.GetValue(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE", "") as string;

            if (path == null)
            {
                path = "Outlook.exe";
            }

            _process = new Process();
            _process.StartInfo.FileName = path;
            if (Settings.ProcessWindowStyle == "Hidden")
            {
                _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            }
            else
            {
                _process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
            }
            _process.StartInfo.UseShellExecute = Settings.UseShellExecuteForOutlook;
            _process.Start();
            _mainWnd = GenericWindow.FindWindow("rctrl_renwnd32", null);
            int begin = Environment.TickCount;

            Tracer._Trace("Waiting while main window is loaded");
            while ((int)_mainWnd == 0 && (Environment.TickCount - begin) < 3000)
            {
                _mainWnd = GenericWindow.FindWindow("rctrl_renwnd32", null);
            }
            Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATEAPP, (IntPtr)1, IntPtr.Zero);
            Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_NCACTIVATE, (IntPtr)0x200001, IntPtr.Zero);
            Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATE, (IntPtr)0x200001, IntPtr.Zero);
            Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATETOPLEVEL, (IntPtr)0x200001, (IntPtr)0x13FBE8);
            Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_SETFOCUS, IntPtr.Zero, IntPtr.Zero);
            _close.Enabled = true;
        }