 |
|
 |
Has anyone used this with the WinForms WebBrowser control from C#?
|
|
|
|
 |
|
 |
I needed just a little part to change the actually work without using dlls or plain c. I used in my project mshtml to parse some information, but unfortunately the embedded browser is generating errors. Now i want to use a running instance of IE.
You don't know how long i searched and how long i studied the microsoft reference. My week is saved and i don't have to go on suicide.
Thanks, Caesten
Caesten
Sunfire
|
|
|
|
 |
|
 |
how to detect the print event?
|
|
|
|
 |
|
 |
after some frustration over the problem, i've stumbled upon this solution:
http://forums.microsoft.com/MSDN/ShowPost.aspx?siteid=1&PostID=2859646
|
|
|
|
 |
|
 |
This link is broken. Perhaps you could give the page title, or search keays that would find it?
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Any body help please.
In the browser if we click on a download llink the file download starts. How to detect which events are fired if the link is not available. Is any VC++ code available.I would like to detect this error for showing a default page.
Regards.
Armando
modified on Tuesday, January 08, 2008 9:46:20 AM
|
|
|
|
 |
|
 |
for example, if there's a javascript onmouseover handler that changes the image source, it gets caught as a refresh event.
example: chorewars.com mouse over the create character button
|
|
|
|
 |
|
 |
I realize I'm posting on a topic that rarely gets responded to. But this is more for those people, like me, who stumble across it looking for a solution.
This method does work well and it will detect the user pressing the refresh button. However, it doesn't work perfectly. The problem is that you're not garunteed to receive a Document Complete event BEFORE all Download Begins and Completes are finished.
For example, let's say you're loading a web page from a relatively quick server. That web page loads remote images from a server that is relatively slow. Now, the good server can probably finish serving the entire HTML before the image server has finished serving images. This leaves Internet Explorer trying to load images, but the document is technically "Complete". IE makes its decision to tell you "Hey, the document is complete." before all the downloads are complete. In this implementation, this would trigger your response to the refresh stuff and could trigger it multiple times, depending on how many images IE has left to load.
Keep this in mind when trying to detect the refresh button by DWebBrowserEvents. You might need to implement timers or check to see whether the document has been loaded (using IHtmlElement and IHtmlDocument2) before doing anything in your refresh handlers.
|
|
|
|
 |
|
 |
Zinkyu wrote: but the document is technically "Complete". IE makes its decision to tell you "Hey, the document is complete." before all the downloads are complete.
Maybe I misunderstood, but I think this is not correct. All I know is that the DocumentComplete event is fired when all downloads are complete. It is not fired when only the DOM is complete.
See http://msdn2.microsoft.com/en-us/library/aa768329.aspx:
The WebBrowser Control fires the DocumentComplete event when the document has completely loaded, and the READYSTATE property has changed to READYSTATE_COMPLETE.
When the HTML doc is loaded only the readystate is set to READYSTATE_INTERACTIVE.
Best regards!
Constantin
|
|
|
|
 |
|
 |
Keep in mind that we're talking purely from the context of sinking the web browser events using DWebBrowserEvents2. I chose to limit my response to that mainly because that's what the article was talking about.
In my experience, however, DOCUMENTCOMPLETE does not get fired consistently after all images have loaded. I'm talking strictly as an IE7 developer, not as someone embedding a WebBrowser control into an application. This causes the refresh logic (as implemented) to trip because the document is complete (making the page counter zero) but downloads are in process. I guess it's one of those things you just have to throw in the debugger.
You have hit on something that I didn't think of, and that's to check for READYSTATE_COMPLETE when the refresh logic is tripped. That's MUCH better than timer crap.
|
|
|
|
 |
|
 |
I found something else where the presented logic fails:
if the website you are visiting uses remote scripting to communicate with a server (dynamically adding a Script tag to the DOM) this triggers DownloadBegin and DownloadComplete events although the user didn't reload the page.
So I guess the only stabel way is to bring IE to truly reload the page if the reload button is pressed...
But I must admit that I don't know how to do that and besides I don't know if there is a reason why IE doesn't actually reloads the page if the button is pressed...
Best regards
Constantin
|
|
|
|
 |
|
 |
You can detect the refresh by first insert special named dummy stylesheet. For each possible refresh event, inspect whether that DOM contains that special dummy stylesheet. Ming
|
|
|
|
 |
|
 |
You'd still have to check this in Download Complete, since IE doesn't fire the Document Complete event on a refresh. Inserting a style sheet, therefore, becomes something that you would do in your refresh handler--and you'd still have to detect the events the author is recommending.
|
|
|
|
 |
|
 |
Any body help please.In the browser if we click on a download llink the file download starts. How to detect which events are fired after clicking the link. Is any Vb.net code available.
Advanced congrats.
|
|
|
|
 |
|
 |
I use IWebBrowser2 interface to display HTML. I would like to block auto-downloading of all images that are located on internet sites (like <IMG SRC="http://some.server.com/image.gif">). I know that it could be done with parsing HTML - but is there an easy way to instruct this control not to use internet connection? Or maybe intercept some event to prevent it from downloading those images?
Thanks for help!
Irek
Check out my software at: http://www.ireksoftware.com
|
|
|
|
 |
|
 |
1. you are implementing IOleCommandTarget interface.
2. in its Exec method compare nCmdID with OLECMDID_xxx defines, for a example OLECMDID_REFRESH
Mike.
|
|
|
|
 |
|
 |
It does not seems working for OLECMDID_REFRESH, but it works for OLECMDID_PRINT.
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
 |
|
 |
HRESULT IOleCommandTarget::Exec(
/*[in]*/ const GUID *pguidCmdGroup,
/*[in]*/ DWORD nCmdID,
/*[in]*/ DWORD nCmdExecOpt,
/*[in]*/ VARIANTARG *pvaIn,
/*[in,out]*/ VARIANTARG *pvaOut)
{
if(nCmdID==2300||nCmdID==6041||nCmdID==6042){
//Refresh event here.
.......
}
Jeremy W.
|
|
|
|
 |
|
|
 |
|
 |
Hi there,
if I have an activex control running on a web browser, Is there a way or could I capture the event of the web browser containing my activex control???
thanks
by the way, nice article
|
|
|
|
 |
|
 |
I do this by having a separate exe program invoke the web browser that my ActiveX control resides in. If the ActiveX control directly needs the events then the exe could pass messages to it.
---------------------------
Steve Foxover
email: steve@stevefoxover.com
Web: http://www.stevefoxover.com
Available for consulting...
---------------------------
|
|
|
|
 |
|
 |
Do you know how to change the Headers in the BeforeNavigate2 event?
I've tried setting them in this event but it doesn't seem to work.
James Johnston
|
|
|
|
 |
|
 |
Yes ; I would like to know this also, how do I look at Headers or modify them? I only get blank string in my code!
CString strHeader = (BSTR)Headers->bstrVal;;
any ideas?
thank u,
Ari
|
|
|
|
 |