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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Passing parameters to an HTML page

Passing parameters to an HTML page

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++html
6 Posts 2 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 Offline
    H Offline
    HawkSoftware
    wrote on last edited by
    #1

    I have a C++ program that has some context information for an HTML page. How can I pass parameters to an HTML page? Thanks, Hawk

    D 1 Reply Last reply
    0
    • H HawkSoftware

      I have a C++ program that has some context information for an HTML page. How can I pass parameters to an HTML page? Thanks, Hawk

      D Offline
      D Offline
      Derek Waters
      wrote on last edited by
      #2

      I'm not entirely sure what you mean about context information and what HTML page you're talking about. If you've got a HTML control and you're using Navigate() to open a page, you just need to append the CGI parameters to your target path. For example for the page:

      http://www.myserver.com/scripts/hello.asp

      you can just append parameters to set the variable 'Name' to 'Joe Blow' and 'Age' to 25 as follows:

      http://www.myserver.com/scripts/hello.asp?Name=Joe+Blow&Age=25

      You need to replace ' 's with '+'s. Also, technically, you need to replace any unprintable characters with escape sequences '%2F'. To find out more, search MSDN for CGI and ISAPI information. Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

      H 1 Reply Last reply
      0
      • D Derek Waters

        I'm not entirely sure what you mean about context information and what HTML page you're talking about. If you've got a HTML control and you're using Navigate() to open a page, you just need to append the CGI parameters to your target path. For example for the page:

        http://www.myserver.com/scripts/hello.asp

        you can just append parameters to set the variable 'Name' to 'Joe Blow' and 'Age' to 25 as follows:

        http://www.myserver.com/scripts/hello.asp?Name=Joe+Blow&Age=25

        You need to replace ' 's with '+'s. Also, technically, you need to replace any unprintable characters with escape sequences '%2F'. To find out more, search MSDN for CGI and ISAPI information. Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

        H Offline
        H Offline
        HawkSoftware
        wrote on last edited by
        #3

        Derek, Thanks for that input. I have just started tinkering with ASP but I think that would require a server right? Here is the scoop. I have a MFC C++ application that uses the WebBrowser2 interface. I am navigating to an HTML file that looks like this: CurrentState.innerHTML = data.transformNode(format.XMLDocument);

        The "TransformCurrentState.xsl" needs to parse through the "CurrentStates.xml" which is a database of several dozen elements. The user can identify which element to be parsed but I don't have any way to tell the script which element is to be parsed. Ideally there would be a way to tell this script something like: building=1 floor=1 room=1. Right now I am doing some pretty ugly stuff. I am generating a small xsl file that is included by the "TransformCurrentState.xsl". It works but it feels wrong so I know there must be a better way. Any more thoughts? Thanks, Steve

        H 1 Reply Last reply
        0
        • H HawkSoftware

          Derek, Thanks for that input. I have just started tinkering with ASP but I think that would require a server right? Here is the scoop. I have a MFC C++ application that uses the WebBrowser2 interface. I am navigating to an HTML file that looks like this: CurrentState.innerHTML = data.transformNode(format.XMLDocument);

          The "TransformCurrentState.xsl" needs to parse through the "CurrentStates.xml" which is a database of several dozen elements. The user can identify which element to be parsed but I don't have any way to tell the script which element is to be parsed. Ideally there would be a way to tell this script something like: building=1 floor=1 room=1. Right now I am doing some pretty ugly stuff. I am generating a small xsl file that is included by the "TransformCurrentState.xsl". It works but it feels wrong so I know there must be a better way. Any more thoughts? Thanks, Steve

          H Offline
          H Offline
          HawkSoftware
          wrote on last edited by
          #4

          That doesn't look to good. Here is the file again: . . . . . . CurrentState.innerHTML = data.transformNode(format.XMLDocument); . . .

          .

          . .

          H 1 Reply Last reply
          0
          • H HawkSoftware

            That doesn't look to good. Here is the file again: . . . . . . CurrentState.innerHTML = data.transformNode(format.XMLDocument); . . .

            .

            . .

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

            For Pete's sake! <.HTML> <.HEAD> <.XML id="data" src="d:/NOWTrak/database/system/CurrentProbeStates.xml"> <.XML id="format" src="TransformCurrentState.xsl"> <.SCRIPT FOR="window" EVENT="onload"> CurrentState.innerHTML = data.transformNode(format.XMLDocument); <./SCRIPT> <.BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BACKGROUND="ATMINOWTRAK.JPG"> <.DIV id="CurrentState" style="position:absolute;left=200;top=10;font-family:'Arial';font-size:12;font-weight:bold"> <./DIV> <./BODY> <./HTML>

            D 1 Reply Last reply
            0
            • H HawkSoftware

              For Pete's sake! <.HTML> <.HEAD> <.XML id="data" src="d:/NOWTrak/database/system/CurrentProbeStates.xml"> <.XML id="format" src="TransformCurrentState.xsl"> <.SCRIPT FOR="window" EVENT="onload"> CurrentState.innerHTML = data.transformNode(format.XMLDocument); <./SCRIPT> <.BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BACKGROUND="ATMINOWTRAK.JPG"> <.DIV id="CurrentState" style="position:absolute;left=200;top=10;font-family:'Arial';font-size:12;font-weight:bold"> <./DIV> <./BODY> <./HTML>

              D Offline
              D Offline
              Derek Waters
              wrote on last edited by
              #6

              Oooh, XML. Sorry, can't help you with that, I'm afraid. I know that if you were using ASP (VBScript here, I'm afraid), and you tried to open: http://www.myserver.com/scripts/hello.asp?Name=Joe+Blow and hello.asp contained: <% vstrName = Request.QueryString("Name") %> then vstrName would contain "Joe Blow". As for how you use that in your XML, I'm not sure. ------------------------ Derek Waters derek@lj-oz.com

              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