Пример #1
0
        public static int LaunchInternetExplorer(Uri uri)
        {
            string address = uri.ToString();

            if (Environment.OSVersion.Version.Major >= 6)
            {
                PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
                IELAUNCHURLINFO     li = new IELAUNCHURLINFO();
                li.cbSize = Marshal.SizeOf(typeof(IELAUNCHURLINFO));
                if (SafeNativeMethods.IELaunchURL(address, ref pi, ref li) < 0)
                {
                    return(0);
                }

                return(pi.dwProcessId);
            }
            else
            {
                throw new NotSupportedException("Protected Mode requires Windows Vista, Windows 7, or later.");
            }
        }
        public static int LaunchInternetExplorer(Uri uri)
        {
            string address = uri.ToString();

            if (Environment.OSVersion.Version.Major >= 6)
            {
                PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
                IELAUNCHURLINFO li = new IELAUNCHURLINFO();
                li.cbSize = Marshal.SizeOf(typeof(IELAUNCHURLINFO));
                if (SafeNativeMethods.IELaunchURL(address, ref pi, ref li) < 0)
                {
                    return 0;
                } 

                return pi.dwProcessId;
            }
            else
            {
                throw new NotSupportedException("Protected Mode requires Windows Vista, Windows 7, or later.");
            }
        }
 internal static extern int IELaunchURL([MarshalAs(UnmanagedType.LPWStr)] string url, ref PROCESS_INFORMATION pProcInfo, ref IELAUNCHURLINFO lpInfo);
 internal static extern int IELaunchURL([MarshalAs(UnmanagedType.LPWStr)] string url, ref PROCESS_INFORMATION pProcInfo, ref IELAUNCHURLINFO lpInfo);