Using MFC to host web browser control
-
Hello, I have created a Dialog App and put a Active X Web browser object into the App. I'm having problems with continuously reporting the current url being visited into a edit box. If I create an event to put the info into the edit box this works fine (example: I created a button that runs the code listed below. This posts the information fine). I would like to continuously show the url being displayed. In this article listed below provided by Microsoft it says to put the code listed at the bottom of this page into the "initialization process", this doesn't seem to work. I have put the code into BOOL CBHCBrowserDlg::OnInitDialog() Microsoft article: If the current location is an HTML page on the World Wide Web, you can use the IWebBrowser2::get_LocationURL methods to retrieve the full path of the folder or file. If you want this information displayed continuously, add the following code to the initialization process. If you want it displayed only when an event occurs, add the code to an event handler. The following example uses IWebBrowser2::get_LocationURL to retrieve location information and display it in an edit box. //CWebBrowser2 m_browser - to access the WebBrowser control //CEdit m_edit - to access the edit control CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1); Any Ideas? THANKS,
-
Hello, I have created a Dialog App and put a Active X Web browser object into the App. I'm having problems with continuously reporting the current url being visited into a edit box. If I create an event to put the info into the edit box this works fine (example: I created a button that runs the code listed below. This posts the information fine). I would like to continuously show the url being displayed. In this article listed below provided by Microsoft it says to put the code listed at the bottom of this page into the "initialization process", this doesn't seem to work. I have put the code into BOOL CBHCBrowserDlg::OnInitDialog() Microsoft article: If the current location is an HTML page on the World Wide Web, you can use the IWebBrowser2::get_LocationURL methods to retrieve the full path of the folder or file. If you want this information displayed continuously, add the following code to the initialization process. If you want it displayed only when an event occurs, add the code to an event handler. The following example uses IWebBrowser2::get_LocationURL to retrieve location information and display it in an edit box. //CWebBrowser2 m_browser - to access the WebBrowser control //CEdit m_edit - to access the edit control CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1); Any Ideas? THANKS,
Hello, the codegurus around the world.;) First of all, this is my guess.:cool: 1) IWebBrowser2 may have some Event function to let us know that now updated html display is completed something like that. So, if this exists, you put get_LocationURL. 2) Try to use Timer or Thread function to always moinitor get_LocationURL. And if URL is updated from old one, update this URL to edit box. :confused: Have a nice day! -Masaaki Onishi-
-
Hello, I have created a Dialog App and put a Active X Web browser object into the App. I'm having problems with continuously reporting the current url being visited into a edit box. If I create an event to put the info into the edit box this works fine (example: I created a button that runs the code listed below. This posts the information fine). I would like to continuously show the url being displayed. In this article listed below provided by Microsoft it says to put the code listed at the bottom of this page into the "initialization process", this doesn't seem to work. I have put the code into BOOL CBHCBrowserDlg::OnInitDialog() Microsoft article: If the current location is an HTML page on the World Wide Web, you can use the IWebBrowser2::get_LocationURL methods to retrieve the full path of the folder or file. If you want this information displayed continuously, add the following code to the initialization process. If you want it displayed only when an event occurs, add the code to an event handler. The following example uses IWebBrowser2::get_LocationURL to retrieve location information and display it in an edit box. //CWebBrowser2 m_browser - to access the WebBrowser control //CEdit m_edit - to access the edit control CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1); Any Ideas? THANKS,
Place the code CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1); in the DocumentComplete Returned Message for your WebBrowser Regardz Colin Davies
-
Place the code CString string1; string1 = m_browser.GetLocationName(); m_edit.SetWindowText(string1); in the DocumentComplete Returned Message for your WebBrowser Regardz Colin Davies
-
Thanks for all the help! I found a event OnDownloadComplete. Everything works great. Thanks.. Rob
Note: OnDownloadComplete fires for every object on a web page eg (jpgs or gifs etc or even frames) OnDocumentComplete fires for the whole Page. Regardz Colin
-
Note: OnDownloadComplete fires for every object on a web page eg (jpgs or gifs etc or even frames) OnDocumentComplete fires for the whole Page. Regardz Colin
-
I didn't see any OnDocumentComplete event for the Microsoft Web Browser Active X object.. :confused: Rob Jones
Rob Using The Class Wizard its the 11th event down for a browser control added as a member variable, I just checked and it is there on my VC+ 6.00 Regardz Colin
-
Rob Using The Class Wizard its the 11th event down for a browser control added as a member variable, I just checked and it is there on my VC+ 6.00 Regardz Colin