Results 1 to 2 of 2
  1. #1

    function pointers in vbscript

    I read about function pointers in one of the vbscript links provided by Terry.
    Accordingly I have written the following code:


    Option Explicit
    Class Test01
    Function t0100
    MsgBox "In t0100"
    End Function

    Function t0110
    MsgBox "In t0110"
    End Function

    Function executeFunctions(strListOfFunctions)
    Dim strFunction
    Dim arrFunctions
    Dim i
    arrFunctions = split(strListOfFunctions)
    For i = 0 to UBound(arrFunctions) - 1
    Set objFuncPtr = setFuncPtr(arrFunctions(i))
    End Function

    Function setFuncPtr(strFuncName)
    Set setFuncPtr = getRef(strFuncName)
    End Function

    End Class
    Function getTest01Instance
    Set getTest01Instance = New test01
    End Function

    In the actual QTP test have the following code:
    Dim objtest01
    Dim strFuncList = "objtest01.t0100 objtest01.t0110"
    Set objtest01 = getTest01Instance
    objtest01.executeFunctions strFuncList
    But I get the error: Invalid procedure call or argument getref.
    So in essence what I want to do is depending on the sequence in which strFuncList is declared, I want to execute the functions. Kindly Please go through the above code and let me know why I am getting the error or how I can write the code in a different/better way.


  2. #2
    SQA Knight
    Join Date
    Jul 1999
    Grand Rapids, MI

    Re: function pointers in vbscript

    Experiment with something simpler--then build up slowly to all this nesting. That should help you isolate your error.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:19 PM.

Copyright BetaSoft Inc.