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. launch an html file

launch an html file

Scheduled Pinned Locked Moved C / C++ / MFC
questionhtmlhelp
17 Posts 3 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.
  • H Halawlaws

    DavidCrow wrote: ShellExecute() what parameters does it take? /\|-||\/|/\|)

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

    Halawlaws wrote: what parameters does it take? See here.


    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

    H 1 Reply Last reply
    0
    • D David Crow

      Halawlaws wrote: what parameters does it take? See here.


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      H Offline
      H Offline
      Halawlaws
      wrote on last edited by
      #5

      can u please write the function with the parameters for a file named C:\help\index.htm? coz it didnt work /\|-||\/|/\|)

      D 1 Reply Last reply
      0
      • H Halawlaws

        can u please write the function with the parameters for a file named C:\help\index.htm? coz it didnt work /\|-||\/|/\|)

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

        Halawlaws wrote: coz it didnt work What does your code look like that did not work?


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        H 1 Reply Last reply
        0
        • D David Crow

          Halawlaws wrote: coz it didnt work What does your code look like that did not work?


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          H Offline
          H Offline
          Halawlaws
          wrote on last edited by
          #7

          ShellExecute(NULL,"open","C:\\help\\index.htm",NULL,NULL,SW_SHOWDEFAULT); /\|-||\/|/\|)

          D 1 Reply Last reply
          0
          • H Halawlaws

            ShellExecute(NULL,"open","C:\\help\\index.htm",NULL,NULL,SW_SHOWDEFAULT); /\|-||\/|/\|)

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

            I assume a browser window did not open the specified file. What value did ShellExecute() return?


            "One must learn from the bite of the fire to leave it alone." - Native American Proverb

            H 1 Reply Last reply
            0
            • D David Crow

              I assume a browser window did not open the specified file. What value did ShellExecute() return?


              "One must learn from the bite of the fire to leave it alone." - Native American Proverb

              H Offline
              H Offline
              Halawlaws
              wrote on last edited by
              #9

              DavidCrow wrote: assume a browser window did not open the specified file. Yes it is true the value is 2 /\|-||\/|/\|)

              R D 2 Replies Last reply
              0
              • H Halawlaws

                DavidCrow wrote: assume a browser window did not open the specified file. Yes it is true the value is 2 /\|-||\/|/\|)

                R Offline
                R Offline
                Ravi Bhavnani
                wrote on last edited by
                #10

                Looks like the file may not exist. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib@ravib.com

                1 Reply Last reply
                0
                • H Halawlaws

                  DavidCrow wrote: assume a browser window did not open the specified file. Yes it is true the value is 2 /\|-||\/|/\|)

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

                  Halawlaws wrote: the value is 2 Look at the link I provided you earlier. 2 = ERROR_FILE_NOT_FOUND. That should be easy enough to diagnose.


                  "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                  H 1 Reply Last reply
                  0
                  • D David Crow

                    Halawlaws wrote: the value is 2 Look at the link I provided you earlier. 2 = ERROR_FILE_NOT_FOUND. That should be easy enough to diagnose.


                    "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                    H Offline
                    H Offline
                    Halawlaws
                    wrote on last edited by
                    #12

                    but it does exist i checked 10 times /\|-||\/|/\|)

                    D 1 Reply Last reply
                    0
                    • H Halawlaws

                      but it does exist i checked 10 times /\|-||\/|/\|)

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

                      Does it work with other .htm files? If you open Windows Explorer and go to the c:\help folder, does double-clicking on the index.htm file open the browser? Are you sure the extension is .htm and not .html? Have you checked the file association in Windows Explorer to make sure that .htm files have an associated application?


                      "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                      H 1 Reply Last reply
                      0
                      • D David Crow

                        Does it work with other .htm files? If you open Windows Explorer and go to the c:\help folder, does double-clicking on the index.htm file open the browser? Are you sure the extension is .htm and not .html? Have you checked the file association in Windows Explorer to make sure that .htm files have an associated application?


                        "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                        H Offline
                        H Offline
                        Halawlaws
                        wrote on last edited by
                        #14

                        no for the 1st question and yes /\|-||\/|/\|)

                        D 1 Reply Last reply
                        0
                        • H Halawlaws

                          no for the 1st question and yes /\|-||\/|/\|)

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

                          What you have should work. Given that it does not, something else is amuck with your machine. This is just a grasp but what if you replace the first parameter with a real window handle instead of NULL? This way if the browser needs to report an error, it can. Windows Explorer might be compensating for something that is missing. Use FindExecutable() to retrieve the name of the .exe that is associated with the .htm file.


                          "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                          H 1 Reply Last reply
                          0
                          • D David Crow

                            What you have should work. Given that it does not, something else is amuck with your machine. This is just a grasp but what if you replace the first parameter with a real window handle instead of NULL? This way if the browser needs to report an error, it can. Windows Explorer might be compensating for something that is missing. Use FindExecutable() to retrieve the name of the .exe that is associated with the .htm file.


                            "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                            H Offline
                            H Offline
                            Halawlaws
                            wrote on last edited by
                            #16

                            Don't worry it worked apparently it turned out that the file path was correct but the file name of my file is index.html and not index.htm. Thanks for ur help in debugging and sorry for wasting your time ciao /\|-||\/|/\|)

                            D 1 Reply Last reply
                            0
                            • H Halawlaws

                              Don't worry it worked apparently it turned out that the file path was correct but the file name of my file is index.html and not index.htm. Thanks for ur help in debugging and sorry for wasting your time ciao /\|-||\/|/\|)

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

                              I suspected that but you did not indicate it was a problem so I pursued other possibilities. Halawlaws wrote: ...sorry for wasting your time If the net result is that you learned something, how has time been wasted?


                              "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                              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