[INCLUDE]
CallFunction
LoadLibrary
FreeLibrary

[CODE]
Public Function CallFunction_Full(ByVal DllFilename As String, ByVal FunctionName As Variant, ParamArray FunctionParams()) As Long
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xChar1 As String

  xLong1 = LoadLibrary(DllFilename)
  If Not xLong1 = 0& Then
    If VarType(FunctionName) = vbString Then 
      xChar1 = FunctionName
      Else
      xChar1 = "#" + CStr(Val(FunctionName))
      End If
    xLong2 = GetProcAddress(xLong1, xChar1)
    If Not xLong2 = 0& Then
      ReDim CallFunction_tmpParam(UBound(FunctionParams()) + 1&)
      For xLong3 = 0& To UBound(FunctionParams())
        CallFunction_tmpParam(xLong3) = FunctionParams(xLong3)
        Next
      CallFunction_Full = CallFunction_Real(FunctionAddress)
#If InIDE Then
      Else
      Debug.Print "Cannot CallFunction_Full, function '" + xChar1 + "' not found in '" + DllFilename + "'"
#End If
      End If
    FreeLibrary(xLong1)
#If InIDE Then
    Else
    Debug.Print "Cannot CallFunction_Full, failed to load dll '" + DllFilename + "'"
#End If
    End If
  End Function
