|
Post by Roger Cabo on Jun 16, 2023 17:09:15 GMT 1
The parameter array is extremely useful like the overload function in c# or c++ But I never know this before until Scalion has used it The ParamArray-Type seems to be always Variant and returns vartype = 250, but its not in the docs. $Library "gfawinx" $Library "UpdateRT" UpdateRuntime ' Patches GfaWin23.Ocx
Dim a| = 255 Dim s$ = "I'm Array Paramater String" Dim p As Pointer Byte Pointer p = V:a|
Debug.Show
// parameter setting.. use more on requirement ParameterProc(a|, s$, p, 40)
// The last parameter pa(4) is empty unfortunately it cannot be accessed by IsMissing(pa(4)) in this case // but the empty pa(1) and pa(2) are accessible by IsMissing(pa(1 or 2)) ParameterProc(a|, , , 77, ) //<----
// Seems to be data type Variant. Procedure ParameterProc(ParamArray pa()) Debug "ParameterProc(ParamArray pa()) // VarType(pa) = 250 but VarType returns is not defined in the docs" Dim maxParam% = UBound(pa()) Debug "Call ParameterProc(ParamArray pa()) //" & maxParam% + 1 & " parameter array elements" If !IsMissing(pa(0)) // parameter 0 exist Debug "a| " & pa(0) Else Debug "Parameter 0 does not exist" EndIf If !IsMissing(pa(1)) // parameter 1 exist Debug "s$ " & p(1) Else Debug "Parameter 1 does not exist" EndIf If !IsMissing(pa(2)) // parameter 2 exist Debug "Pointer content of var a| " & pa(2) & " // but pa() is not a pointer in this case" Else Debug "Parameter 2 does not exist" EndIf If !IsMissing(pa(3)) // parameter 3 exist Debug "Any parameter was given: " & pa(3) Else Debug "parameter 3 does not exist" EndIf Debug EndProcedure
|
|
|
Post by dragonjim on Jun 17, 2023 15:14:44 GMT 1
Have a look in the English Help File under Functions, Procedure & Subs. ParamArray us covered in some detail there.
|
|