Function with 2 return Value

My application makes use of a special dll. This dll has a function:

Function ReaderType(Byref Par1 as Uint32) as Uint32

  Soft Declare Function GetReaderType Lib "uFCoder1x.dll" (byref get_reader_type  As Uint32) As UInt32
  
  Return GetReaderType(Par1) 

The function GetReaderType of the Lib “uFCoder1x.dll” return 2 value: a normalu Return Value Uint32 and also it write another Uint32 in the parameter that i pass it!(Par1)

And it work: if i put a breakpoint in Return GetReaderType(Par1) in Par1 there is the information that i need.

But when i call Function ReaderType(xyz) in xyz there is 0 (zero).

Is there a solution?
Thank you in advance.

I would “assume” from what you have indicated that that is in fact the correct value…

But to “prove” it… here is what I’d do…(because your code looks ok).
add a line BEFORE the return… that says Parl=12345
if the function STILL returns Zero… then that is what it should be…
if it returns 12345 then the Declare is not altering the byref value at all, and returns what was passed.

Along Dave’s line of reasoning, you can also “intercept” the value.

Function ReaderType(Byref Par1 as Uint32) as Uint32

  Soft Declare Function GetReaderType Lib "uFCoder1x.dll" (byref get_reader_type  As Uint32) As UInt32
  
  dim r as UInt32
  dim myPar1 as UInt32 = Par1

  r = GetReaderType(myPar1) 
  Par1 = myPar1 // Break here to compare the values before this assignment
  return r
End Function

[quote]r = GetReaderType(myPar1)
return r[/quote]
Based on my understanding of the code, and the OP’s question, you want to return par1, not r.

I think r is the result (presumably some error code?), while par1 is the actual value of readerType.

Or am I missing something?

I want to explain me better, since my english is not so good.

The following code stay in a Module

[code]
Function ReaderType(Byref Par1 as Uint32) as Uint32

Soft Declare Function GetReaderType Lib “uFCoder1x.dll” (byref get_reader_type As Uint32) As UInt32

Return GetReaderType(Par1)
End Function[/code]

Then I call the function in a window:

Dim z as Uint32
z = ReaderType(xyz)

z = 0 // correct
xxy = 0 // NOT correct , i need 3507814433

I think r is the result (presumably some error code?), while par1 is the actual value of readerType.

Yes Peter you have understand well! But i need both r and Par1.

r is error code and i need!
Par1 is readerType and i need!

[quote=72431:@fabio stranieri]>I think r is the result (presumably some error code?), while par1 is the actual value of readerType.

Yes Peter you have understand well! But i need both r and Par1.

r is error code and i need!
Par1 is readerType and i need![/quote]

I see that I did miss something - the fact that par1 is byRef in your function. Sorry for my reading too fast…

Fabio, you forgot “ByRef Par1” in the declaration.

Ack, Kem just beat me to it!

You are right!

Thank you very much!