'=========================================================================== ' Subject: RETURN LARGEST VALUE Date: 01-20-98 (12:14) ' Author: Dave Navarro, Jr. Code: PBDLL ' Origin: dave@powerbasic.com Packet: PBDLL.ABC '=========================================================================== '---------------------------------------------------------------------------- ' ' MINS for PB/DLL 2.0 ' Copyright (c) 1997-98 by PowerBASIC, Inc. ' ' Return the largest value in a single-precision array ' ' ' In Visual Basic: ' ' Declare Function MinS! Lib "MINS.DLL" (x!, ByVal TotalElements&) ' ' Sub y() ' ReDim x!(1 to 100) ' '** Fill the array here ** ' Value! = MinS!(x!(1), 100) 'pass the first element and total elements ' End Sub ' ' FUNCTION MinS(BYVAL xPtr AS DWORD, BYVAL nElems AS LONG) EXPORT RETPRM AS SINGLE DIM x AS SINGLE PTR DIM z AS SINGLE DIM i AS LONG ' ** Assign address of first element to pointer variable x = xPtr ' ** Loop through all the elements FOR i = 0 TO nElems - 1 ' ** If element is larger than current largest, use it instead IF @x[i] > z THEN z = @x[i] END IF NEXT i ' ** Return the largest value FUNCTION = z END FUNCTION