473,378 Members | 1,321 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

focus on IE

Thanks for your promptly answer Nicholas,

but I do have another question. How do I set the focus to the IE window, so
that it becomes active. I've been googling on it, but none of the answer
seem to work.

thanks again,

Bart.
Nov 15 '05 #1
3 1793
Bart,

You can do this by calling the FindWindow (to find the Window handle of
IE, if you don't already have it) and then SetForegroundWindow (to bring it
to the foreground) to set the active window before calling the methods on
the SendKeys class. Of course, you will have to call these through the
P/Invoke layer.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"dawn" <da******@hotmail.com> wrote in message
news:Ml*********************@phobos.telenet-ops.be...
Thanks for your promptly answer Nicholas,

but I do have another question. How do I set the focus to the IE window, so that it becomes active. I've been googling on it, but none of the answer
seem to work.

thanks again,

Bart.

Nov 15 '05 #2
FYI
I seem to remember that this will not actually bring the window to the
foreground unless the caller is in the same process space, otherwise you
just get the relevent taskbar item flashing for attention. This was
deliberately put in by MS to stop rogue applications snatching focus.

Regards
Lee
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ul****************@TK2MSFTNGP12.phx.gbl...
Bart,

You can do this by calling the FindWindow (to find the Window handle of IE, if you don't already have it) and then SetForegroundWindow (to bring it to the foreground) to set the active window before calling the methods on
the SendKeys class. Of course, you will have to call these through the
P/Invoke layer.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"dawn" <da******@hotmail.com> wrote in message
news:Ml*********************@phobos.telenet-ops.be...
Thanks for your promptly answer Nicholas,

but I do have another question. How do I set the focus to the IE window,

so
that it becomes active. I've been googling on it, but none of the answer
seem to work.

thanks again,

Bart.


Nov 15 '05 #3
If you control the page yo are going to display on the IE you could use
window.focus();

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"dawn" <da******@hotmail.com> wrote in message
news:Ml*********************@phobos.telenet-ops.be...
Thanks for your promptly answer Nicholas,

but I do have another question. How do I set the focus to the IE window, so that it becomes active. I've been googling on it, but none of the answer
seem to work.

thanks again,

Bart.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for...
2
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a...
3
by: VA | last post by:
t=document.getElementById('mytable') is a HTML table with some input fields in its cells Why doesnt t.getElementsByTagName('tr').firstChild.focus; put the focus on that text field? It...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
1
by: avnrao | last post by:
Hi, I am facing a problem with control.focus (javascript). Here is the description of the issue. 1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on this, will redirect...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
7
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click'...
4
by: Roger | last post by:
Hi, I am confused about the differences between this.window.focus(), window.focus(), and this.focus(). I want to use the calls in a <body onload="..."tag. What are the differences between...
3
by: jp2express | last post by:
I have several applications that use panels as screens, but I can *not* seem to set the focus for a Textbox. Panel1.BringToFront() Panel1_Textbox.Focus() ' do something with a control on Panel1...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.