Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / June 2004

Tip: Looking for answers? Try searching our database.

saving a webpage in vc++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sachin - 10 Jun 2004 00:11 GMT
Hi everybody,

The following snippet is part of a software. This software runs on a webpage and the following snippet saves that webpage. The problem is that untill i close down the website on which the software is working the process of  saving file is not getting completed. I want the software to be running on that website so the website to be open while the page is saved. Please help.

   

CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTMLDocument2;

CComPtr<IDispatch> pDisp;

MessageBox("Saving file","",MB_OK);
_Module.m_pWebBrowser->get_Document(&pDisp);

spHTMLDocument2 = pDisp;

IPersistFile* pFile     = NULL;                                        

                                if(SUCCEEDED(spHTMLDocument2->QueryInterface(IID_IPersistFile, (void **)&pFile)))
{
                                       

    if ((pFile->Save(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\news\\urlName.htm",FALSE)) == E_FAIL)
                                           
    {
        MessageBox("Unable to Save File", "", MB_OK);
    }

                                            if((pFile->SaveCompleted(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\news\\urlName.htm")) == E_FAIL)
    {

            MessageBox("Unable to SaveComplete File", "", MB_OK);
    }
}

                /********/

        MessageBox("Saved file","",MB_OK);
int a;                           
                           
            pDisp.Release();       
           
            //a = pFile->Release();
            pFile->Release();
            MessageBox("Handle Released", "", MB_OK);
            CloseHandle(hProcess);
       

Even i tried using the following snippet but the same result was obtained

            LPDISPATCH lpDispatch=GetHtmlDocument();
                LPDISPATCH lpDispatch=pDisp;
                IPersistFile *lpPersistFile = NULL;
                lpDispatch->QueryInterface(IID_IPersistFile, (void**)&lpPersistFile);
                USES_CONVERSION;
//                LPCOLESTR TheFileName=A2COLE("c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\news\\urlName.htm");
                lpPersistFile->Save(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\news\\urlName.htm",1);
                lpPersistFile->SaveCompleted(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\news\\urlName.htm");
//                lpPersistFile->Save(TheFileName,0);
                lpPersistFile->Release();

I wasnt able to save using the function LPCOLESTR. I was getting error when i used that but was able to save using function L.

Please help on the above topic.
Ajay Kalra - 13 Jun 2004 13:56 GMT
I am curious as to why you are not using URLDOwnloadToFile  to do this?

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com

> Hi everybody,
>
> The following snippet is part of a software. This software runs on a webpage and the following snippet saves that webpage. The problem is that
untill i close down the website on which the software is working the process
of  saving file is not getting completed. I want the software to be running
on that website so the website to be open while the page is saved. Please
help.

> CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTMLDocument2;
>
[quoted text clipped - 11 lines]
>
> if
((pFile->Save(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files\\ne
ws\\urlName.htm",FALSE)) == E_FAIL)

> {
> MessageBox("Unable to Save File", "", MB_OK);
> }

if((pFile->SaveCompleted(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom
\\files\\news\\urlName.htm")) == E_FAIL)
> {
>
[quoted text clipped - 22 lines]
> USES_CONVERSION;
> // LPCOLESTR
TheFileName=A2COLE("c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\files
\\news\\urlName.htm");

lpPersistFile->Save(L"c:\\593\\eclipse\\workspace\\pardom\\partitionDom\\fil
es\\news\\urlName.htm",1);

lpPersistFile->SaveCompleted(L"c:\\593\\eclipse\\workspace\\pardom\\partitio
nDom\\files\\news\\urlName.htm");
> // lpPersistFile->Save(TheFileName,0);
> lpPersistFile->Release();
>
> I wasnt able to save using the function LPCOLESTR. I was getting error when i used that but was able to save using function L.
>
> Please help on the above topic.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.