How to open Internet Explorer Window (own new Process! + no Toolba

23/05/2009 - 10:36 von Victory | Report spam
Hi all,

I am desperately seeking for a solution to this problem:

I would like to open via C# a new internet explorer window which has no
toolbars, but when opening the window it has to be in a new internet explorer
process.

I have managed to open the internet explorer explicitly in a new process with:

ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = url;
Process process = new Process();
process.StartInfo = startInfo;
try
{
process.Start();
}
catch (Exception e)
{
MessageBox.Show("Exception - Could not start process!"+e, "Error",
MessageBoxButtons.OK);
}

I also managed to start a new internet explorer window without toolbar and
statusbar with following code:

SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp)ie;
wb.MenuBar = false;
wb.ToolBar = 0;
wb.StatusBar = false;
wb.Visible = true;
wb.Navigate(url, ref o, ref o, ref o, ref o);
//Maximize IE window, 3=maximize
ShowWindow(wb.HWND, 3);

But I don't know exactly how to do both at the same time, starting the IE in
a new process and managing the appearance. I need to open the IE everytime in
a new process as the opened web application needs that for session management.

Thanks in advance for your help

Regards

Victor
 

Lesen sie die antworten

#1 Frank Dzaebel
23/05/2009 - 15:51 | Warnen spam
Hallo,

hier sprechen wir Deutsch und benutzen gerne den
vollen Vor- und Zunamen als Username.

I also managed to start a new internet explorer
window without toolbar and statusbar with following code:



was fehlt denn dann noch.
Das sollte doch funktionieren:

// Verweise einbinden:
// %windir%\system32\shdocvw.dll

private void Form1_Load(object sender, EventArgs e)
{
string url = "http://www.test.de";
this.TopLevel = false; this.Hide();
// [Befehlszeilenoptionen für Internet Explorer 4.0]
// http://support.microsoft.com/kb/q178058/
// Process.Start("iexplore", "-k " + url);
// Process p = Process.Start("iexplore", "-new " + url);
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp)ie;
wb.MenuBar = false; wb.ToolBar = 0; wb.StatusBar = false;
object flags = o; //=BrowserNavConstants.NavOpenInNewWindow;
object targetFrameName = o; // = "_Blank";
wb.Navigate(url, ref flags, ref targetFrameName, ref o, ref o);
wb.Visible = true;
ShowWindow(new IntPtr(wb.HWND), WindowShowStyle.Maximize);
this.Close();
}

static object o = Type.Missing;

[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd,
WindowShowStyle nCmdShow);

/// <summary> [ShowWindow Function ()]
/// http://msdn.microsoft.com/en-us/library/ms633548(VS.85).aspx
/// </summary>
private enum WindowShowStyle
{
Maximize = 3 // ToDo: einfügen
}

/// <summary> [BrowserNavConstants Enumeration]
/// http://msdn.microsoft.com/en-us/library/dd565688(VS.85).aspx
/// </summary>
enum BrowserNavConstants
{
NavOpenInNewWindow = 0x1 // ToDo: einfügen
}


ciao Frank
Dipl.Inf. Frank Dzaebel [MCP/MVP C#]
http://Dzaebel.NET

Ähnliche fragen