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. how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2

how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
4 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.
  • A Offline
    A Offline
    awah
    wrote on last edited by
    #1

    how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2 void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { } "URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance!

    A D 2 Replies Last reply
    0
    • A awah

      how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2 void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { } "URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance!

      A Offline
      A Offline
      ajitatif angajetor
      wrote on last edited by
      #2

      you can use the V_BSTR macro to get it done. the macro returns a BSTR that you can use to obtain a CString. something like this may help/work: BSTR bstrUrl = V_BSTR(URL); CString cstrUrl(bstrUrl);

      1 Reply Last reply
      0
      • A awah

        how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2 void MyDialog::OnDocumentCompleteExplorer1(LPDISPATCH pDisp, VARIANT FAR* URL) { } "URL" here contains the url that has been completed. but it is a variant type. i want to as a CString type so that i can check it. i tried casting but it doesnt work. does anyone knows how to do it? - MFC style - winxp - vc6.0 thanks in advance!

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

        awah wrote:

        "URL" here contains the url that has been completed. but it is a variant type.

        A variant type has many different subtypes, one of which is a BSTR. For example:

        COleVariant vtURL(URL, VT_BSTRT);
        CString strURL = V_BSTRT(&vtURL);

        Or:

        CString strURL(V_BSTR(URL));


        "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

        A 1 Reply Last reply
        0
        • D David Crow

          awah wrote:

          "URL" here contains the url that has been completed. but it is a variant type.

          A variant type has many different subtypes, one of which is a BSTR. For example:

          COleVariant vtURL(URL, VT_BSTRT);
          CString strURL = V_BSTRT(&vtURL);

          Or:

          CString strURL(V_BSTR(URL));


          "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

          A Offline
          A Offline
          awah
          wrote on last edited by
          #4

          thanks!

          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