How to open webpage

Hey i have one problem. I try to open internet explorer windows with www adres for example www.microsoft.com. I want that when i click on button. And the seccond question how to do that but when i want to open not a IE but a software on m computer like test.exe.

Thanks for answer and help me



Answer this question

How to open webpage

  • ErickGB

    Thanks.

  • Rozan

    using namespace System;
    using namespace System::Runtime::InteropServices;

    // Declare the function that is exported from unmanaged dll (shell32.dll).
    [DllImport("shell32.dll")]
    extern "C" int _cdecl ShellExecute(int hwnd, // Handle to a parent window.
    String *strVerb, // Action to be performed.
    String *strFileName, // File or object on which to execute the specified verb.
    String *strParameters, // Parameters to be passed to the application.
    String *strDirectory, // Default directory.
    int nShowCmd); // Flags.



  • DavidG

    Hi but when i do that:

    private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) {

    LONG r = ShellExecute(NULL, "open", "http://www.microsoft.com", NULL, NULL, SW_SHOWNORMAL);

    }

    i have some errors like ShellExecute identifer not found :/


  • Dr Frankenstein

    You can do all of this with the function ShellExecute!

    Define the http URL and call it, or define the path to the EXE. If you defne a document the corresponding executable is launched the the file is loaded.



  • MaxCrash

    Since you are writing a managed app, you might as well use System::Diagnostics::Process instead of P/Invoke-ing a native API call.

  • How to open webpage