Trying to launch a site!!!! Please HELP!!!

This is a discussion on Trying to launch a site!!!! Please HELP!!! within the C++ Programming forums, part of the General Programming Boards category; Hi, I was wondering if anyone can help me. Im working in a 16-bit environment in Visual C++, version 1.52. ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Question Trying to launch a site!!!! Please HELP!!!

    Hi,

    I was wondering if anyone can help me. Im working in a 16-bit environment in Visual C++, version 1.52. Trying to launch a site from the code. I've tried using WinExec and ShellExecute, but with no luck. Both only work for links with up to 120 characters or so, but my link is much much longer. Anyone knows of anything else I can try.

    Thanks in advance,
    Vicky

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    Put it in a batch file and launch that.

    gg

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Unhappy Still Stuck

    Thanks so much for your help, but unfortunately the batch file also limits the length of the link string. My string is still too long for it.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    So why are you still using windows3 when even win9x is nearly obsolete
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    Create a URL shortcut and launch that.

    gg

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    To create a URL shortcut, drag and drop the icon pointed to by the red arrow.

    gg
    Attached Images Attached Images  

  7. #7
    Registered User
    Join Date
    Dec 2003
    Posts
    6
    Yes, that is exactly what I am doing. I paste the location of the IE and the shortcut into the batch file. Run the batch file. It launches IE and only uses half of the link. It cuts it off when it runs out of space I guess.

    Thanks for your help!!!
    Last edited by kissa49; 12-17-2003 at 02:03 PM.

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    "URL shortcut" and "batch file" or two different things.

    Follow the instructions for creating a URL shortcut. You'll want to drag and drop the icon (pointed to by the red arrow) to your desktop or some other directory.

    This will create a file with .url extension (explorer will hide the extension and call it a "shortcut").
    Just type the filename in a command window to see it is going to work for you.

    gg

  9. #9
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Unhappy

    I see what you're saying, I misunderstood before. That is a really good idea, the only thing is, the link will keep changing. So I dont think that it will work for me. I'll try to play around with it though.
    Thank you very much!

    -Vicky

  10. #10
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    The actual contents of the shortcut is plain text:
    Code:
    [DEFAULT]
    BASEURL=http://www.cprogramming.com/
    [InternetShortcut]
    URL=http://www.cprogramming.com/
    Modified=D0B89D5CDEC4C301E7
    I tried changed "cprogramming" to "google" and it worked ok.

    gg

  11. #11
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    This is all you need:
    Code:
    [InternetShortcut]
    URL=http://www.google.ca/
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  12. #12
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Red face

    The link will keep changing in the code and with out stopping the program the page will need to get launched.

    Im very confused.

  13. #13
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    Do you know how to create and write to a file?

    gg

  14. #14
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    Code:
    #include <fstream>
    #include <string>
    #include <cstdlib>
    using namespace std;
    
    
    bool launch_url(const char *url)
    {
        ofstream out("temp.url");
    
        if (!out)
            return false;
    
        out << "[InternetShortcut]" << endl 
            << "URL=" << url << endl;
    
        out.close();
    
        return system("temp.url") != -1;
    }//launch_url
    
    
    int main()
    {
        launch_url("www.google.com");
    
        return 0;
    }//main
    gg

  15. #15
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Thumbs up THANK YOU!!!

    to: Codeplug

    sorry that this is late,
    but...
    I wanted to say thanks a million for your valuable time to answer my question. my problem has been solved. THANKS AGAIN FOR ALL YOUR HELP!!!


Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting HTTP status of a site in C under Linux
    By anti4kd in forum C++ Programming
    Replies: 3
    Last Post: 01-03-2009, 12:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21