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. COM
  4. preparing DISPPARAMS for a method??

preparing DISPPARAMS for a method??

Scheduled Pinned Locked Moved COM
helpquestion
5 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.
  • M Offline
    M Offline
    Muhammad Azam
    wrote on last edited by
    #1

    hi I am writing an IDispatch client. i want to call this method void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); using IDispatch::Invoke. I have got DISPID of this method using GetIDsOfNames, the problem is in making DISPPARAMS for this method that can be passed to Invoke. does any one know how do we prepare DISPPARAMS for such type of methods as mentioned above. Thanks in anticipation Azam

    V 1 Reply Last reply
    0
    • M Muhammad Azam

      hi I am writing an IDispatch client. i want to call this method void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); using IDispatch::Invoke. I have got DISPID of this method using GetIDsOfNames, the problem is in making DISPPARAMS for this method that can be passed to Invoke. does any one know how do we prepare DISPPARAMS for such type of methods as mentioned above. Thanks in anticipation Azam

      V Offline
      V Offline
      Vi2
      wrote on last edited by
      #2

      CComBSTR strFile, strMiscFile, strValue; VARIANTARG* rgvarg = new VARIANTARG[3]; V_VT(&rgvarg[2]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[2]) = &strFile; V_VT(&rgvarg[1]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[1]) = &strMiscFile; V_VT(&rgvarg[0]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[0]) = &strValue; DISPPARAMS dispparams = { rgvarg, NULL, 3, 0 }; With best wishes, Vita

      M 1 Reply Last reply
      0
      • V Vi2

        CComBSTR strFile, strMiscFile, strValue; VARIANTARG* rgvarg = new VARIANTARG[3]; V_VT(&rgvarg[2]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[2]) = &strFile; V_VT(&rgvarg[1]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[1]) = &strMiscFile; V_VT(&rgvarg[0]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[0]) = &strValue; DISPPARAMS dispparams = { rgvarg, NULL, 3, 0 }; With best wishes, Vita

        M Offline
        M Offline
        Muhammad Azam
        wrote on last edited by
        #3

        hi Vita Thank you very much for solving my problem. One thing i would also like to ask if you donot mind, how do we pass named parametrs to a function. lets say if the function is same as mentioned in my previous question i.e void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); then how do v prepare DISPPARAMS for this function using named arguments? thanks in anticipation Azam

        V 1 Reply Last reply
        0
        • M Muhammad Azam

          hi Vita Thank you very much for solving my problem. One thing i would also like to ask if you donot mind, how do we pass named parametrs to a function. lets say if the function is same as mentioned in my previous question i.e void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); then how do v prepare DISPPARAMS for this function using named arguments? thanks in anticipation Azam

          V Offline
          V Offline
          Vi2
          wrote on last edited by
          #4

          Look at Automation: Passing Parameters[^] But I don't recommend you to use the named arguments. With best wishes, Vita

          M 1 Reply Last reply
          0
          • V Vi2

            Look at Automation: Passing Parameters[^] But I don't recommend you to use the named arguments. With best wishes, Vita

            M Offline
            M Offline
            Muhammad Azam
            wrote on last edited by
            #5

            Thanks once again. i will read this article. may i distrub u if i need some help in between :) regards Azam

            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