Answered by:
How to fire events on windows?

Question
-
Hi,
I have a scenario like whenever a popup window occurs from IE, an event should fire so that I can get the htmldocument. I know how to identify the popup window and get the htmldocument from it. Only thing I need is I should be notified whenever a pop occurs.
Can anyone suggest me how to identify that a new window is opened or closed in c# or vb.net?
Swarnamala
Tuesday, June 26, 2012 8:50 AM
Answers
-
Hi,
what I understood is, that he is not looking for a solution to open a new window from an ASP.Net webpage.
Instead he wants to get an event, when a new window was created. The following CodeProject article shows how such a global hook could be created:
http://www.codeproject.com/Articles/38523/How-to-Write-a-Managed-Global-Hook-for-Window-CreaWith kind regards,
Konrad
Tuesday, June 26, 2012 11:02 AM -
Hi Swarnamala ,
You can use the SHDocVwCtl.WebBrowser_V1 object to capture the NewWindow event.
Please refer to the answer in this link:
http://stackoverflow.com/questions/7639398/get-popup-information-with-webbrowser .The sample code of SHDocVwCtl.WebBrowser_V1 object is in the first link of this answer metioned above .
Regards ,
Lisa Zhu [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Lisa Zhu Friday, July 6, 2012 9:00 AM
Monday, July 2, 2012 5:39 AM
All replies
-
Please try to use the ScriptManager.RegisterStartupScript
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "newWindow", "window.open(<your Page Url<your New="" Properties="" window=""></your>>);", false);
Sample
window.open("http://www.w3schools.com")
With Thanks and Regards
Sambath Raj.C
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
Happy Programming!- Proposed as answer by RohitArora Tuesday, June 26, 2012 9:01 AM
Tuesday, June 26, 2012 8:58 AM -
Hi,
what I understood is, that he is not looking for a solution to open a new window from an ASP.Net webpage.
Instead he wants to get an event, when a new window was created. The following CodeProject article shows how such a global hook could be created:
http://www.codeproject.com/Articles/38523/How-to-Write-a-Managed-Global-Hook-for-Window-CreaWith kind regards,
Konrad
Tuesday, June 26, 2012 11:02 AM -
Hi,
I am automating IE in c#. So when I open a browser from c#, and in that if any popups occur, it should fire an event so that I can get the popupwindow from which I can get the htmldocument and add events to it. So I want to fire an event whenever a popup comes from the browser which I have launched from c#.
Swarnamala
Wednesday, June 27, 2012 5:44 AM -
Hi Swarnamala ,
You can use the SHDocVwCtl.WebBrowser_V1 object to capture the NewWindow event.
Please refer to the answer in this link:
http://stackoverflow.com/questions/7639398/get-popup-information-with-webbrowser .The sample code of SHDocVwCtl.WebBrowser_V1 object is in the first link of this answer metioned above .
Regards ,
Lisa Zhu [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Lisa Zhu Friday, July 6, 2012 9:00 AM
Monday, July 2, 2012 5:39 AM