CWebBrowser - Saving DHTML source ? 
Author Message
 CWebBrowser - Saving DHTML source ?

Hi,

I'm using:

        pBody->get_innerHTML(&bstr);

and can successfully get the source for a static web page.

But when i try it with a dynamic web page, i get an empty string ?

Is there a way to get the source of a dynamic web page ?

I've also tried the following code from www.codeguru.com:

 CWnd* pWnd = NULL;

 CWnd* pwndShell = m_mybrowser.GetWindow(GW_CHILD); // get the webbrowser
window pointer

 if (pwndShell)
 {
  pWnd = pwndShell->GetWindow(GW_CHILD);  //get the child window pointer
 }

 if(pWnd != NULL)
 {
  WPARAM wParam = MAKELONG(IDM_VIEWSOURCE, 1);
  pWnd->SendMessage(WM_COMMAND, wParam, (LPARAM)m_mybrowser.m_hWnd);
 }

This works fine, and displays the source in a new window (notepad on my
machine).

But i'd like to auto save the source to a file or CString.

Any ideas ?

Duncan



Mon, 05 Apr 2004 19:08:33 GMT  
 CWebBrowser - Saving DHTML source ?
Hi

Try to get the doucment interface by IWebBrowser2::get_Document().
Afterward, query the IPersistStreamInit from the document interface and call
IPersistStreamInit->Save() to IStream. You can create the IStream by
CreateSteramOnHGlobal. The final step is call GlobalLock() to cast back the
LPTSTR pointer and from the HGLOBAL handle.

Thanks

Andre


Quote:
> Hi,

> I'm using:

>         pBody->get_innerHTML(&bstr);

> and can successfully get the source for a static web page.

> But when i try it with a dynamic web page, i get an empty string ?

> Is there a way to get the source of a dynamic web page ?

> I've also tried the following code from www.codeguru.com:

>  CWnd* pWnd = NULL;

>  CWnd* pwndShell = m_mybrowser.GetWindow(GW_CHILD); // get the webbrowser
> window pointer

>  if (pwndShell)
>  {
>   pWnd = pwndShell->GetWindow(GW_CHILD);  //get the child window pointer
>  }

>  if(pWnd != NULL)
>  {
>   WPARAM wParam = MAKELONG(IDM_VIEWSOURCE, 1);
>   pWnd->SendMessage(WM_COMMAND, wParam, (LPARAM)m_mybrowser.m_hWnd);
>  }

> This works fine, and displays the source in a new window (notepad on my
> machine).

> But i'd like to auto save the source to a file or CString.

> Any ideas ?

> Duncan



Tue, 06 Apr 2004 20:33:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Source save integration is unwealdy

2. Latest version form Source Save

3. VC++ 6 often fails to save source file

4. error: can't save source file

5. BMP save EGA in Turbo C help needed (C source here-)

6. Saving source file bookmarks?

7. Using VC++ 6 can't recompile a saved source file

8. MFC source for File Save As?

9. DHTML Dialog

10. DHTML to active x web browser?

11. DHTML

12. ATL DHTML Control in VS.NET

 

 
Powered by phpBB® Forum Software