Open IE pop-up from C# .NET

I know how to open an IE window of any size from another IE hyperlink, however;

Q. How do I open an IE window approx. 300 X 400 without toolbars, etc... directly from C# .NET code?
LVL 1
kvnsdrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shaival_trivediCommented:
Hi,

this may help you
                              
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "iexplore";
myProcess.Start();


and for 300 X 400 size you could use "SetWindowsPos"  Api and pass myProcess.MainWindowHandle as windows handle.

kvnsdrAuthor Commented:
I have no idea what your refering to concerning your last statement:

"and for 300 X 400 size you could use "SetWindowsPos"  Api and pass myProcess.MainWindowHandle as windows handle."
zstafaCommented:
1. Open a new windows app
2. drag a button on to the form
3. Double click on it
4. Paste this into it.

                    object o = null;

                    SHDocVw.InternetExplorer ie = new
                         SHDocVw.InternetExplorerClass();

                    IWebBrowserApp wb = (IWebBrowserApp) ie;
                    wb.Visible = true;
                    wb.ToolBar = 0;

                    wb.Navigate("www.google.com", ref o, ref o, ref o, ref o);


5. Right click on references and click add the SHDocVw.dll reference in windows/system32
6.make sure to add "Using SHDocVw;"    at the top
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

kvnsdrAuthor Commented:
Perfect. I reordered the code to eliminate the initial full-screen IE Window quick-flash (before reducing to the disired size) and it works perfect .

Using SHDocVw

SHDocVw.InternetExplorer ie = new
SHDocVw.InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp) ie;                  
wb.ToolBar = 0;
wb.Height = 400;
wb.Width = 200;
wb.Navigate("www.google.com", ref o, ref o, ref o, ref o);
wb.Visible = true;


Q. I also need to open an htm file located in my bin folder.  (...more points...)

kvnsdrAuthor Commented:
Also finding the IE window does not open on-top of other windows. So I tried this javascript, but does not seem to affect it.

Also have my C# Windows Form1 properties set to: [Window Style] TopMost = false, howeve still same problem.

<body onload = "SetWindow();">
      
<script language = 'javascript'>
function SetWindow()
{                   
window.focus();
}
</script>
zstafaCommented:
Are these windows that you want to change the z-order the same? Will they have the same title? You could use the window api in your c#

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows.asp

Once you find the handle to the window or the window title, you can use the windows api to control that window. Good Luck

Z
zstafaCommented:
Try using this javascript

<BODY onBlur="self.focus()"> <body>

Z
zstafaCommented:
Actually onblur might cause problems. try this

<BODY onLoad="self.focus()"> <body>

Z

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zstafaCommented:
Sorry again, make sure both <body> tags are the same. Z
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.