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. ATL / WTL / STL
  4. about parameter

about parameter

Scheduled Pinned Locked Moved ATL / WTL / STL
11 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.
  • Y yingkou

    I have built a interface as below: HRESULT GetBSTR1([out,retval]BSTR* bstrInfo); If VBScript call this component method the codes as below: Set aaa = CreateObject("ATLTest.TestOne") v1=aaa.GetBSTR1() MsgBox v1 OK and if I build my interface into HRESULT GetBSTR2([out]BSTR* bufName1,[out,retval]BSTR* bufName2); how the VBScript call this method

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

    I Don't know about vbscript but in VB

    Dim a As New TESTCOM1Lib.TestInterface
    Dim str, str1 As String
    str = a.GetBSTR2(str1)
    MsgBox str1, vbOKOnly, str

    ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

    Y 2 Replies Last reply
    0
    • T ThatsAlok

      I Don't know about vbscript but in VB

      Dim a As New TESTCOM1Lib.TestInterface
      Dim str, str1 As String
      str = a.GetBSTR2(str1)
      MsgBox str1, vbOKOnly, str

      ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

      Y Offline
      Y Offline
      yingkou
      wrote on last edited by
      #3

      Sorry I haven't ever learned VB Private Sub Form_Load() Dim a As New ATLTESTLib.ITestTWO Dim str, str1 As String str = a.GetBSTR2(str1) MsgBox str1, vbOKOnly, str End Sub Compile Error and My COM Interface Is: interface ITestOne : IDispatch { [id(1), helpstring("method GetBSTR1")] HRESULT GetBSTR1([out,retval]BSTR* bstrInfo); [propget, id(2), helpstring("property property")] HRESULT property([out, retval] long *pVal); [propput, id(2), helpstring("property property")] HRESULT property([in] long newVal); }; [object,uuid(6FFD87E9-5733-4DF2-A33A-161D44FBC7D0),dual,helpstring("ITestTwo Interface"),pointer_default(unique)] interface ITestTwo : IUnknown { [id(1), helpstring("method GetBSTR2")] HRESULT GetBSTR2([out]BSTR* bufName1, [out,retval]BSTR* bufName2); }; [uuid(D8F2F3E6-3356-437B-849D-087CCD9439F0),version(1.0),helpstring("ATLTest 1.0 Type Library")] library ATLTESTLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); [ uuid(9072075F-656A-4B1C-9809-17A6164D1507), helpstring("TestOne Class") ] coclass TestOne { [default] interface ITestOne; }; };

      1 Reply Last reply
      0
      • T ThatsAlok

        I Don't know about vbscript but in VB

        Dim a As New TESTCOM1Lib.TestInterface
        Dim str, str1 As String
        str = a.GetBSTR2(str1)
        MsgBox str1, vbOKOnly, str

        ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

        Y Offline
        Y Offline
        yingkou
        wrote on last edited by
        #4

        I haven't ever learned VB before,your codes are compiled and error happened

        T 1 Reply Last reply
        0
        • Y yingkou

          I haven't ever learned VB before,your codes are compiled and error happened

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

          Wait i will send you code for both application send me mail at alok@efextra.com ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

          1 Reply Last reply
          0
          • Y yingkou

            I have built a interface as below: HRESULT GetBSTR1([out,retval]BSTR* bstrInfo); If VBScript call this component method the codes as below: Set aaa = CreateObject("ATLTest.TestOne") v1=aaa.GetBSTR1() MsgBox v1 OK and if I build my interface into HRESULT GetBSTR2([out]BSTR* bufName1,[out,retval]BSTR* bufName2); how the VBScript call this method

            J Offline
            J Offline
            Jorgen Sigvardsson
            wrote on last edited by
            #6

            If I recall correctly, VBScript can't handle out-only parameters. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. I blog too now[^]

            Y 1 Reply Last reply
            0
            • J Jorgen Sigvardsson

              If I recall correctly, VBScript can't handle out-only parameters. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. I blog too now[^]

              Y Offline
              Y Offline
              yingkou
              wrote on last edited by
              #7

              thanks for your answer.Do you mean VBScript can onle receive [out retval] parameter

              J 1 Reply Last reply
              0
              • Y yingkou

                thanks for your answer.Do you mean VBScript can onle receive [out retval] parameter

                J Offline
                J Offline
                Jorgen Sigvardsson
                wrote on last edited by
                #8

                It turns out that VBScript can do [out] parameters, but only if the type of the parameter is VARIANT, as this article[^] explains. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. I blog too now[^]

                Y 1 Reply Last reply
                0
                • J Jorgen Sigvardsson

                  It turns out that VBScript can do [out] parameters, but only if the type of the parameter is VARIANT, as this article[^] explains. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. I blog too now[^]

                  Y Offline
                  Y Offline
                  yingkou
                  wrote on last edited by
                  #9

                  thanks a lot

                  Y 1 Reply Last reply
                  0
                  • Y yingkou

                    thanks a lot

                    Y Offline
                    Y Offline
                    yingkou
                    wrote on last edited by
                    #10

                    could I say that if I build a compnent used by VBScript and other script language,the parameter should be dedined VARIANT

                    J 1 Reply Last reply
                    0
                    • Y yingkou

                      could I say that if I build a compnent used by VBScript and other script language,the parameter should be dedined VARIANT

                      J Offline
                      J Offline
                      Jorgen Sigvardsson
                      wrote on last edited by
                      #11

                      For out-parameters, that is a good strategy I'd say, as script languages are often weakly typed. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. I blog too now[^]

                      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