Jump to content

How can I refresh the default browser page?

- - - - -

  • Please log in to reply
5 replies to this topic

#1
alex1

alex1

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
Hello - I made a simply code:


#include <fstream>

#include <iostream>

#include <conio.h>

#include <windows.h>


using namespace std;


int main (){

    char ch;

    char buffer[256];


    MessageBox(NULL,"WELCOME \n press ok to continue","WELCOME",MB_OK);

    

    ifstream urls ("urls.txt");

    while (! urls.eof() ){

    urls.getline (buffer,100);

    {

   ShellExecute(NULL, "open", buffer,

                NULL, NULL, SW_SHOWNORMAL);

    }

                          }

  cout<<"\n\n\n\n\n\n\nURLs Loaded successfully!\n";

  cout<<"-------------------------\n\n\n";

  getch();

  return 0;

}

Ok this is loading a bunch of pages,wich are saved in a file called "urls.txt"

My question is - If there is just 1 page loaded,how can I refresh it every 5 seconds?

Any help is high appreciated!
I'm just going crazy with this :D

#2
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts
If your goal is to merely achieve the refreshment, use Opera browser.
In it you can define the automatic refresh interval. If on the other
hand your purpose is to find out how to do it programmatically, I'm
thinking you're gonna have a hard time with that. A few ideas come
to mind that could have some merit (haven't tried most of them):
  • A browser has command line command for the refresh. I highly
    doubt that there is one.
  • A browser offers some kind of plugin or API through which you
    issue commands. This is most likely true to some extent but it
    might require for you to create it yourself.
  • Use a tool designed to control a browser. Selenium is one with
    which I'm most familiar with and it's a great tool but I'm thinking
    there's no support for C++ as that'd be pretty insane.


#3
alex1

alex1

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
Oh..Thanks for your answer!I suppose that I will not do it trought a c++ code :P

Thanks again!

#4
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
Isn't refreshing simply sending a (http) request for that page again?
A conclusion is where you got tired of thinking.
#define class struct    // All is public.

#5
alex1

alex1

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
hmmm..if I send a http request its opening the same page in a new tab...maybe I'm mistaking on somthing...

#6
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

alex1 said:

hmmm..if I send a http request its opening the same page in a new tab...maybe I'm mistaking on somthing...
I actually considered this option and thought that it'd open a new tab or window so didn't mention it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users