苏飞论坛

标题: 调用默认IE打开网页 [打印本页]

作者: freesky    时间: 2013-7-10 15:32
标题: 调用默认IE打开网页


[code=csharp]     /// <summary>
        /// 调用默认IE打开网页
        /// </summary>
        /// <param name="strUrl"></param>
        public static void OpenUrl(string strUrl)
        {
            RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
            string s = key.GetValue("").ToString();
            int iIndex = s.LastIndexOf(".exe") + 3;
            string BrowsePath = s.Substring(1, iIndex);//"Ccation\360se.exe" -- "%1"

            //s就是你的默认浏览器,不过后面带了参数,把它截去
            try
            {
                System.Diagnostics.Process.Start(BrowsePath, strUrl);
                //System.Diagnostics.Process.Start("iexplore.exe", strUrl);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Process.Start("iexplore.exe", strUrl);
            }


        }[/code]

作者: 站长苏飞    时间: 2013-7-10 16:52
问题是什么,没看懂




欢迎光临 苏飞论坛 (http://www.sufeinet.com/) Powered by Discuz! X3.4