I want to use a function inside the wnaspi32.dll 'SendASPI32Command" which is defined as

DWORD SendASPI32Command ( LPSRB psrb ) ;

but the struct that is passed through can be variable in size so i dont want to use aliases for the function and then declare them as follows:-

Private Declare Function Send1 Lib "wnaspi32" Alias "SendASPI32Command" (ByRef UDT as UDT1) as Long

Private Declare Function Send2 Lib "wnaspi32" Alias "SendASPI32Command" (ByRef UDT as UDT2) as Long

So what I tried is:-

Private Declare Function Send1 Lib "wnaspi32" (ByRef UDT as Any) as Long

but i get a Bad DLL calling convention, if i put an On Error Resume Next before the DLL Call the function does seem to have executed though because there are values in UDT, but function doesn't return a value.

Does anybody know how i can get around the problem?