La struttura che segue è tipica di VB:
codice:
Private Type WaveInCaps
ManufacturerID As Integer
ProductID As Integer
DriverVersion As Long
ProductName(1 To 32) As Byte
Formats As Long
Channels As Integer
Reserved As Integer
End Type
In Perl la posso rendere tramite Win32::API::Struct
codice:
Win32::API::Struct->typedef(WAVEINCAPS => qw(
INT ManufacturerID;
INT ProductID;
LONG DriverVersion;
TCHAR ProductName[32];
LONG Formats;
INT Channels;
INT Reserved;
)
);
In VB chiamo o lego una struttura ad una variabile cosi':
codice:
Dim Caps As WaveInCaps
In Perl lo farò cosi':
codice:
my $caps = Win32::API::Struct->new('WAVEINCAPS');
La chiamata e il passaggio di valori alla funzione nella DLL in VB avviene cosi':
codice:
Call waveInGetDevCaps(0, VarPtr(Caps), Len(Caps))
Cosi' in Perl:
codice:
my $result = waveInGetDevCaps(
0,
$caps,
Win32::API::Struct->sizeof('WAVEINCAPS')
);
informazioni per il modulo Win32::API::Struct