NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

'Paramters out of present range' error when calling ActiveX EXE method

TestStand 2.0f
Windows 2000 Pro SP4
MS Visual Basic 6.0

I have an ActiveX EXE I built using MS VB 6.0. I can use the ActiveX EXE
fine in VB and other ActiveX aware clients. When I try to call one method
from TestStand, I get a run-time error. The information gathered in
'SequenceFilePostStepRuntimeError' reports: (-17502) "Parameter
'i32ParamID': Out of present range.".

The ActiveX method, called GetParamString is declared in VB as:

Public Sub GetParamString(ByVal i32UutSite As Long, ByVal i32ParamID As
Long, sParamValue As String)

In the Sequence Editor, TestStand seems to recognize everything fine...
i32UutSite Number in
i32ParamID Number in
sParamValue String in/out

For i32ParamID, I am trying t
o pass the value of a StationGlobal, which
happens to be 4026544129 or 0xF0003001.

If I pass 0 for i32ParamID instead of the StationGlobal, the method gets
called. I get the 'Out of present range' error whether I specify 0xF0003001
via a StationGlobal or as a numeric literal. Unlike with the C DLL adapter,
I can't seem to specify the numeric format (short, int, long, etc) TestStand
whould pass when calling and ActiveX method. TestStand seems to be saying
that 0xF0003001 is an invalid value for a Number, or at least a Long,
neither of which is the case as far as I am aware.

Am I doing something stupid? Is this value illegal for a Number in
TestStand? Is there a way to force TestStand to pass this value to the
method as a Long without error?

---
Joe
0 Kudos
Message 1 of 5
(3,475 Views)
Hi Joe,

From MSDN...

"Caution: If you are interfacing with components written in Visual Basic version 6.0, for example Automation or COM objects, keep in mind that Long has a different data width (32 bits) in Visual Basic 6.0.

Furthermore, Automation does not support 64-bit integers on certain platforms, including Windows 2000 and Windows 98. You cannot pass a Visual Basic .NET Long argument to an Automation component on such platforms."

Therefore the maximum number you can have is 21474483648. Try this, it should work. Changing everything to a double should work.

Hope this helps!

Bob
0 Kudos
Message 2 of 5
(3,475 Views)
Bob

> "Caution: If you are interfacing with components written in Visual
> Basic version 6.0, for example Automation or COM objects, keep in mind
> that Long has a different data width (32 bits) in Visual Basic 6.0.

The value I'm passing is 0xF0003001, which is a 32-bit number. It should
fit fine into a VB 6.0 Long variable. I can pass the exact same value from
other ActiveX clients to the same method and everything works as expected.
I'm not using any .NET code.

I've passed 32-bit hex values from TestStand to VB 6.0 ActiveX components in
the past with no problem. I don't recall any of the values being this
large, but it ~should~ work since its well within the 32-bit integer value
range.

It seems that TestStand isn't treating the value as a 32-bit val
ue, but as a
signed integer. Values if 0x7FFFFFF (the max signed 32-bit integer value)
and below work, values of 0x8000000 (0x7FFFFFFF + 1) and above do not. Even
if I tell TestStand to represent the value as an unsigned integer, I still
get an error when passing values greater than 0x7FFFFFF.

Does anyone know a way to get TestStand to treat a Number as a true 32-bit
integer when passing it to an ActiveX method?

> Therefore the maximum number you can have is 21474483648. Try this,
> it should work. Changing everything to a double should work.

I may have to add a second interface that supports doubles instead of longs
in order to get things to work. I was just wondering if there was a way to
make TestStand treat the values as true 32-bit integers. I'd rather not go
through the trouble of a workaround if its not necessary.

Thanks...

---
Joe
0 Kudos
Message 3 of 5
(3,475 Views)
Hi Joe,

Use this expression to convert a signed integer:

Val(Str( Locals.numhex, "%i" )) // convert unsigned int to signed before passing

Let me know if this works.

Bob
0 Kudos
Message 4 of 5
(3,475 Views)
Bob,

> Use this expression to convert a signed integer:
>
> Val(Str( Locals.numhex, "%i" )) // convert unsigned int to signed
> before passing
>
> Let me know if this works.

It works! No TestStand error. All 32-bits make it to the ActiveX method.

Thanks for the help.

---
Joe
0 Kudos
Message 5 of 5
(3,475 Views)