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 a local html-file

ShellExecute a local html-file

Scheduled Pinned Locked Moved C / C++ / MFC
htmlcomquestion
8 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.
  • N Offline
    N Offline
    Niklas L
    wrote on last edited by
    #1

    Hi Is it possible to open a html-file at a given anchor-point using ShellExecute? Or should I use another method? I tried to use the following argument to ShellExecute open file://C:/afile.htm#alocation and the file opens, but always from the top. drives me crazy tia

    home

    T M 2 Replies Last reply
    0
    • N Niklas L

      Hi Is it possible to open a html-file at a given anchor-point using ShellExecute? Or should I use another method? I tried to use the following argument to ShellExecute open file://C:/afile.htm#alocation and the file opens, but always from the top. drives me crazy tia

      home

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      ::ShellExecute(NULL, _T("open"), _T("C:\\afile.htm#alocation"), NULL, NULL, SW_SHOWNORMAL);


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      N 1 Reply Last reply
      0
      • N Niklas L

        Hi Is it possible to open a html-file at a given anchor-point using ShellExecute? Or should I use another method? I tried to use the following argument to ShellExecute open file://C:/afile.htm#alocation and the file opens, but always from the top. drives me crazy tia

        home

        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        The file: URL parsing has changed in IE 7.0 to be stricter. That means you may see differences between IE 6.0 and 7.0. See here[^] for how to properly construct a file: URL.

        Stability. What an interesting concept. -- Chris Maunder

        1 Reply Last reply
        0
        • T toxcct

          ::ShellExecute(NULL, _T("open"), _T("C:\\afile.htm#alocation"), NULL, NULL, SW_SHOWNORMAL);


          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          Honestly, you haven't tried that, have you? Do you at all think it will work?

          home

          T 1 Reply Last reply
          0
          • N Niklas L

            Honestly, you haven't tried that, have you? Do you at all think it will work?

            home

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            Niklas Lindquist wrote:

            Honestly, you haven't tried that, have you?

            yes i did, and you ? :~

            Niklas Lindquist wrote:

            Do you at all think it will work?

            not it will, it does ! :doh:


            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            N 1 Reply Last reply
            0
            • T toxcct

              Niklas Lindquist wrote:

              Honestly, you haven't tried that, have you?

              yes i did, and you ? :~

              Niklas Lindquist wrote:

              Do you at all think it will work?

              not it will, it does ! :doh:


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              I get ERROR_FILE_NOT_FOUND from that. (Which to me seems like a reasonable thing, since the number character is valid in a windows path.) Adding "file://" in front will bring up the correct file, but always shown from the top. Removing "#alocation" also works (in that it brings up the correct file, but not located at the anchor point obviously). WinXP IE6 I still doubt that it works for you. :sigh:

              home

              T 1 Reply Last reply
              0
              • N Niklas L

                I get ERROR_FILE_NOT_FOUND from that. (Which to me seems like a reasonable thing, since the number character is valid in a windows path.) Adding "file://" in front will bring up the correct file, but always shown from the top. Removing "#alocation" also works (in that it brings up the correct file, but not located at the anchor point obviously). WinXP IE6 I still doubt that it works for you. :sigh:

                home

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                ah, sorry, it was the anchor that matters... have you tried passing te anchor parameter into the "parameters" argument ? like this (this one, i didn't test) :

                ::ShellExecute(NULL, _T("open"), _T("C:\\afile.htm"), _T("#alocation"), NULL, SW_SHOWNORMAL);


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                N 1 Reply Last reply
                0
                • T toxcct

                  ah, sorry, it was the anchor that matters... have you tried passing te anchor parameter into the "parameters" argument ? like this (this one, i didn't test) :

                  ::ShellExecute(NULL, _T("open"), _T("C:\\afile.htm"), _T("#alocation"), NULL, SW_SHOWNORMAL);


                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  N Offline
                  N Offline
                  Niklas L
                  wrote on last edited by
                  #8

                  Been there, done that. Right now it feels like I've tried every single possibility but the right one. Maybe one should use another function altogether? Or is it even impossible, since I'd like it to work with Firefox et al aswell, depending on default browser? I don't want to add browser dependencies to the code.

                  home

                  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