SemperFiDownUnda
Instructor
Hey Guy and Gals,
I seem to be a bit stuck. This is fairly involved so those that have not the time or interest can move on now.
I'm attempting to write a generic test harness from our COM+ DLLs. It runs from scripts. Each line of the script indicates what library.class to create, what method to run, and what the values of the parameters are to be. The parameter values before are loaded into a grid along with the names of the parameters (I'm grabbing them with the TLI library). The return value of the method is also grabbed. The method is then to be called with the parameters. The results loaded into a 2nd grid and the returning values of the parameter to be put below the starting values in the first grid. These grids are then written out to a EXCEL worksheet to capture the results of the test and the next line in the script is executed.
Now I can get simple functionally with the "CallByName" method but as many of you know this has 2 main draw backs. 1st is the error (if any) that is returned isn't the actual error that occurred in the DLL.
2nd is the parameters are inherently ByVal so I have no way of knowing what changed in the DLL's code.
So I started using the EnvokeHook and EnvokeHookArray that directly overcomes the return error problem. But with parameters coming back in the EnvokeHookArray the variant array used is also inherently ByVal. A work around I've read suggests manually setting the VT_BYREF bit in each element of the variant array after setting the element by using VarPtr. Not only is this not producing results it is also very volatile and crashes the entire app more often than not.
So my next thought was how about I make my test harness scriptable and have it auto generate the code and pass in a instance of a class that has the values of the parameter, run the generated script which before it finishes set the return values of the parameters back into that class. This works to an extent but seems that the vb script is having a problem calling the method passing variants so they need to be cast which I can do.....but then if I cast them they become inherently ByVal again.
I really want to get this working and any suggestions would greatly be appreciated
Oh, I grant it could be my code in many or all parts. I’ll post the code for those that suggest things I have tried/should try but since there isn’t a whole lot of documentation on what I’m trying to do I don’t think it will help at this point. I have 4 other developers here looking at it also and only 1 has been even to make any suggestions.
Thanks Wayne
I seem to be a bit stuck. This is fairly involved so those that have not the time or interest can move on now.
I'm attempting to write a generic test harness from our COM+ DLLs. It runs from scripts. Each line of the script indicates what library.class to create, what method to run, and what the values of the parameters are to be. The parameter values before are loaded into a grid along with the names of the parameters (I'm grabbing them with the TLI library). The return value of the method is also grabbed. The method is then to be called with the parameters. The results loaded into a 2nd grid and the returning values of the parameter to be put below the starting values in the first grid. These grids are then written out to a EXCEL worksheet to capture the results of the test and the next line in the script is executed.
Now I can get simple functionally with the "CallByName" method but as many of you know this has 2 main draw backs. 1st is the error (if any) that is returned isn't the actual error that occurred in the DLL.
2nd is the parameters are inherently ByVal so I have no way of knowing what changed in the DLL's code.
So I started using the EnvokeHook and EnvokeHookArray that directly overcomes the return error problem. But with parameters coming back in the EnvokeHookArray the variant array used is also inherently ByVal. A work around I've read suggests manually setting the VT_BYREF bit in each element of the variant array after setting the element by using VarPtr. Not only is this not producing results it is also very volatile and crashes the entire app more often than not.
So my next thought was how about I make my test harness scriptable and have it auto generate the code and pass in a instance of a class that has the values of the parameter, run the generated script which before it finishes set the return values of the parameters back into that class. This works to an extent but seems that the vb script is having a problem calling the method passing variants so they need to be cast which I can do.....but then if I cast them they become inherently ByVal again.
I really want to get this working and any suggestions would greatly be appreciated
Oh, I grant it could be my code in many or all parts. I’ll post the code for those that suggest things I have tried/should try but since there isn’t a whole lot of documentation on what I’m trying to do I don’t think it will help at this point. I have 4 other developers here looking at it also and only 1 has been even to make any suggestions.
Thanks Wayne