Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to open a website using "ShellExecute" ?

Phrozen SmokePhrozen Smoke Posts: 2Member
Hello all,
Following is a piece of code which i'm making.

From a file, to which fp is pointing, i'm extracting some strings in 'buff' (its an array)
ptr -> Its holding a URL (suppilied as command line argument)
So at the last i've 'arr' which has that URL appended with some string.

e.g buff -> ' OR 1=1--
prt -> www.google.com

Hence 'arr' becomes: www.google.com' OR 1=1--

code:
*******************************************************************

while(fgets(buff, 19, fp)!=NULL) //reading the strings one by one.
{
for(i=0;i<50;i++) //flushing out the array.
arr[i]='';
strcat(arr, ptr); //copying URL to the array.
strcat(arr,buff); //appending string behind that URL.
// fputs(arr, fp1); //writing to the file URL.txt
// fputs("
", fp1);

ShellExecute(NULL,"open","arr","",NULL,SW_SHOW);
}

*******************************************************************
So this way i'll have around 15-20 URL's. Now i'm using the function ShellExecute so that all such URL's get opened in different pages in a browser.
As i don't know win API so i'm not comfortable with it.
Simply passing 'arr' is not helping.

So anyone please tell me how should i achieve the requirement ???


regards

Comments

  • Phrozen SmokePhrozen Smoke Posts: 2Member
    : Hello all,
    : Following is a piece of code which i'm making.
    :
    : From a file, to which fp is pointing, i'm extracting some strings in 'buff' (its an array)
    : ptr -> Its holding a URL (suppilied as command line argument)
    : So at the last i've 'arr' which has that URL appended with some string.
    :
    : e.g buff -> ' OR 1=1--
    : prt -> www.google.com
    :
    : Hence 'arr' becomes: www.google.com' OR 1=1--
    :
    : code:
    : *******************************************************************
    :
    : while(fgets(buff, 19, fp)!=NULL) //reading the strings one by one.
    : {
    : for(i=0;i<50;i++) //flushing out the array.
    : arr[i]='';
    : strcat(arr, ptr); //copying URL to the array.
    : strcat(arr,buff); //appending string behind that URL.
    : // fputs(arr, fp1); //writing to the file URL.txt
    : // fputs("
    ", fp1);
    :
    : ShellExecute(NULL,"open","arr","",NULL,SW_SHOW);
    : }
    :
    : *******************************************************************
    : So this way i'll have around 15-20 URL's. Now i'm using the function ShellExecute so that all such URL's get opened in different pages in a browser.
    : As i don't know win API so i'm not comfortable with it.
    : Simply passing 'arr' is not helping.
    :
    : So anyone please tell me how should i achieve the requirement ???
    :
    :
    : regards
    :


    Ok, problem solved !!!
    It should be like this:

    while(fgets(buff, 19, fp)!=NULL)
    {
    for(i=0;i<100;i++)
    arr[i]='';
    strcat(arr, ptr);
    strcat(arr,buff);
    fputs(arr, fp1);
    fputs("
    ", fp1);
    ShellExecute(NULL, "open", "iexplore.exe", arr, "C:\Program Files\Internet Explorer", SW_SHOW);
    }

    regards

Sign In or Register to comment.