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. WinExec() Function

WinExec() Function

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
12 Posts 7 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.
  • S Offline
    S Offline
    santhoshv84
    wrote on last edited by
    #1

    I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

    Regards. SANTHOSH V

    P P Z H D 5 Replies Last reply
    0
    • S santhoshv84

      I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

      Regards. SANTHOSH V

      P Offline
      P Offline
      Paresh Chitte
      wrote on last edited by
      #2

      It is not neccessary that on every machine IE has been installed. It may be possible that user is having the other browser (mozilla, Netscape, etc) instead of IE. So, how are you handling this situation, just for curiosity. Regards, Paresh.

      S 1 Reply Last reply
      0
      • S santhoshv84

        I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

        Regards. SANTHOSH V

        P Offline
        P Offline
        Perspx
        wrote on last edited by
        #3

        I believe that: WinExec("iexplore.exe",SW_NORMAL); will execute Internet Explorer.. As IE is usually pre-installed with Windows, it is often recognised as a command line function.. For example, opening up the "Run" box in windows (Windows key+R) and typing in "iexplore.exe", Internet Explorer WILL run. Hope this helps! --PerspX

        "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates

        S 1 Reply Last reply
        0
        • P Perspx

          I believe that: WinExec("iexplore.exe",SW_NORMAL); will execute Internet Explorer.. As IE is usually pre-installed with Windows, it is often recognised as a command line function.. For example, opening up the "Run" box in windows (Windows key+R) and typing in "iexplore.exe", Internet Explorer WILL run. Hope this helps! --PerspX

          "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates

          S Offline
          S Offline
          santhoshv84
          wrote on last edited by
          #4

          I tried this. WinExec("iexplorer.exe",SW_NORMAL); :(( Bus it is not working. Because IE is not istalled in Windows Directory. In my system, it is in "C:\WINDOWS\ie7\iexplorer.exe". It is about the version also. We can`t say it is constant in all the system. So there must be other solution.

          Thanks and Regards. SANTHOSH V

          O 1 Reply Last reply
          0
          • P Paresh Chitte

            It is not neccessary that on every machine IE has been installed. It may be possible that user is having the other browser (mozilla, Netscape, etc) instead of IE. So, how are you handling this situation, just for curiosity. Regards, Paresh.

            S Offline
            S Offline
            santhoshv84
            wrote on last edited by
            #5

            Actually i gave Function and executed the IE. But i have to give full path. I used this application in other system. There IE is installed in D:\. If IE is not installed its Ok. If installed we have to find it.

            Thanks and Regards. SANTHOSH V

            P 1 Reply Last reply
            0
            • S santhoshv84

              Actually i gave Function and executed the IE. But i have to give full path. I used this application in other system. There IE is installed in D:\. If IE is not installed its Ok. If installed we have to find it.

              Thanks and Regards. SANTHOSH V

              P Offline
              P Offline
              Paresh Chitte
              wrote on last edited by
              #6

              Is querying below from registry

              HKEY_CLASSES_ROOT\Applications\iexplore.exe\shell\open\command

              will help you ? Regards, Paresh.

              S 1 Reply Last reply
              0
              • S santhoshv84

                I tried this. WinExec("iexplorer.exe",SW_NORMAL); :(( Bus it is not working. Because IE is not istalled in Windows Directory. In my system, it is in "C:\WINDOWS\ie7\iexplorer.exe". It is about the version also. We can`t say it is constant in all the system. So there must be other solution.

                Thanks and Regards. SANTHOSH V

                O Offline
                O Offline
                Optimus Chaos
                wrote on last edited by
                #7

                Hi, The question is what do you want to achieve? Do you just want to open a browser window (user default browser or specifically IE?) or do you want to display a web site. You should also take ShellExecute into consideration. This method allows you to also open a website using the default browser or IE directly and it shouldn't matter where your browser is installed. Hope this helps. Best regards

                1 Reply Last reply
                0
                • P Paresh Chitte

                  Is querying below from registry

                  HKEY_CLASSES_ROOT\Applications\iexplore.exe\shell\open\command

                  will help you ? Regards, Paresh.

                  S Offline
                  S Offline
                  santhoshv84
                  wrote on last edited by
                  #8

                  This is working. Thank you for the Help. HKEY_CLASSES_ROOT\Applications\iexplore.exe\shell\open\command :-D Thank you once again.

                  Thanks and Regards. SANTHOSH V

                  1 Reply Last reply
                  0
                  • S santhoshv84

                    I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

                    Regards. SANTHOSH V

                    Z Offline
                    Z Offline
                    zhang800605
                    wrote on last edited by
                    #9

                    ShellExecute(NULL,"open","about:blank",NULL,NULL,SW_SHOW); or keybd_event(0xac,0,0,0); keybd_event(0xac,0,KEYEVENTF_KEYUP,0);

                    S 1 Reply Last reply
                    0
                    • Z zhang800605

                      ShellExecute(NULL,"open","about:blank",NULL,NULL,SW_SHOW); or keybd_event(0xac,0,0,0); keybd_event(0xac,0,KEYEVENTF_KEYUP,0);

                      S Offline
                      S Offline
                      santhoshv84
                      wrote on last edited by
                      #10

                      Thank you. It is working. Thank you for the kind help.

                      Thanks and Regards. SANTHOSH V

                      1 Reply Last reply
                      0
                      • S santhoshv84

                        I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

                        Regards. SANTHOSH V

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #11

                        But did you see MSDN about this function,of the MSDN "Note This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function."


                        WhiteSky


                        1 Reply Last reply
                        0
                        • S santhoshv84

                          I am using WinExec() function in a project. The WinExec function runs the specified application. Example: WinExec("notepad.exe",SW_NORMAL); But i want to run Internet Explorer in WinExec(). In each and every system Internet Explorer will not be installed in same path. So, i want to know is there other way except by giving actual path..

                          Regards. SANTHOSH V

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          You can either let the OS decide which browser to open by calling ShellExecute() with the name of the HTML file you want to open, or you can call FindExecutable() (or AssocQueryString()) to get the full path of the associated application.


                          "A good athlete is the result of a good and worthy opponent." - David Crow

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          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