CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Building Interactive UIs with ASP.NET Ajax: Rebinding Client-Side Events After a Partial Page Postback
  • Speed Up Repetitive Insert, Update, and Delete Query Statements
  • Binding Data to Silverlight 4.0 Controls Using ASP.NET MVC Framework 2.0
  • ADO.NET Data Services in the .NET Framework

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 13th, 2009, 07:26 AM
    anandtugaon anandtugaon is offline
    Member
     
    Join Date: May 2007
    Posts: 134
    anandtugaon is an unknown quantity at this point (<10)
    HTTP port 80

    Hi All,

    i want write data(when user open the browser i.e when he open "www.codeguru.com" and browse 5 minutes. what he browsed this duration i nedd write to file) to file,

    So how to i connect this port and get data from this port.??

    and if he opend 2 URL i.e codeguru & google so how can i identify these url and write data to respective files?

    Thanks,
    Anand
    Reply With Quote
      #2    
    Old July 17th, 2009, 06:38 AM
    anandtugaon anandtugaon is offline
    Member
     
    Join Date: May 2007
    Posts: 134
    anandtugaon is an unknown quantity at this point (<10)
    Re: HTTP port 80

    Hi Friends,

    Using this code(WININIT) i am able to get the information for URL "http://www.codeguru.com/"

    i am using wininit.

    BOOL CInternetApp::InitInstance()
    {
    HINTERNET hINet, hFile;
    hINet = InternetOpen("InetURL/1.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
    if ( !hINet )
    {
    AfxMessageBox("InternetOpen Failed");
    return 0;
    }
    hFile = InternetOpenUrl( hINet, "http://www.codeguru.com/", NULL, 0, INTERNET_FLAG_EXISTING_CONNECT, 0 ) ;

    if ( hFile ){

    FILE *pFile;
    CHAR buffer[1024];
    DWORD dwRead;
    pFile = fopen("C:\\HTTP.txt", "w");
    while ( InternetReadFile( hFile, buffer, 500, &dwRead ) ) \{
    if ( dwRead == 0 )break;
    buffer[dwRead] = 0;
    if( pFile == NULL) {
    MessageBox(NULL,"Unable write data to file ","HTTP ERROR",MB_TOPMOST); return -1;
    }
    fprintf(pFile, "%s", buffer);
    }
    fclose(pFile);
    }
    return FALSE;
    }


    Here i am lunching the URL through code and stored data in C:\HTTP.txt file(its come from HTTP port).


    But my requrment is when user open the browser and enter URL name say "www.codeguru.com" from onwards i want to write all data loaded on web page to HTTP.txt file till user close that URL.(if user moved one page to another web page we have to write that data to file).

    Is this way possible?

    any suggestion is heartly welcome.

    Thanks,
    Anand
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:37 AM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.