Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ShellExecute with new instance

ShellExecute with new instance

Scheduled Pinned Locked Moved C / C++ / MFC
com
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K Sushilkumar
    wrote on last edited by
    #1

    Hi All, I am trying to open a web page using the following code.

    ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);

    It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.

    L L R S 4 Replies Last reply
    0
    • K K Sushilkumar

      Hi All, I am trying to open a web page using the following code.

      ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);

      It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.

      L Offline
      L Offline
      L Madhavan
      wrote on last edited by
      #2

      You will have to retrieve the path to the default browser and directly execute it, passing in the URL as a parameter.

      ShellExecute(this->m_hWnd, _T("open"), pathToBrowser, _T("www.xyz.com"), NULL, SW_SHOWNORMAL);

      1 Reply Last reply
      0
      • K K Sushilkumar

        Hi All, I am trying to open a web page using the following code.

        ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);

        It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, This ShellExecute documentation[^] states: If the default Web browser currently runs, ShellExecute tells the instance that runs to go to your Uniform Resource Locator (URL). If it is not running, ShellExecute starts the application and then browses to your URL. Looks like the default behavior. You may need to use CreateProcess[^] instead. Best Wishes, -David Delaune

        1 Reply Last reply
        0
        • K K Sushilkumar

          Hi All, I am trying to open a web page using the following code.

          ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);

          It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.

          R Offline
          R Offline
          Rahul Vaishnav
          wrote on last edited by
          #4

          below code will open in new instance

          ShellExecute(this->m_hWnd, _T("open"), _T("firefox.exe"), _T("www.google.com"), NULL, SW_SHOWNORMAL);

          or

          ShellExecute(this->m_hWnd, _T("open"), _T("iexplore.exe"), _T("www.google.com"), NULL, SW_SHOWNORMAL);

          1 Reply Last reply
          0
          • K K Sushilkumar

            Hi All, I am trying to open a web page using the following code.

            ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);

            It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            K. Sushilkumar wrote:

            The above code will open a new tab (www.xyz.com) in the existing instance

            K. Sushilkumar wrote:

            Now what i want is to open my web page with new instance.

            Firefox decides (depending on the options you select in Firefox) where a URL should be opened. Your program has no way of altering that.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups