L
Larry
How come the chunk of code below doesn't work?
#!/perl
use strict;
use warnings;
use Win32::API;
my ($caps, $devices, $result);
Win32::API::Struct->typedef( 'WAVEINCAPS', qw(
INT ManufacturerID;
INT ProductID;
LONG DriverVersion;
TCHAR ProductName[32];
LONG Formats;
INT Channels;
INT Reserved;
)) or die "Typedef error $!\n";
my $caps = Win32::API::Struct->new('WAVEINCAPS'); # Dim Caps As
WaveInCaps
Win32::API->Import( winmm => "int waveInGetNumDevs()");
Win32::API->Import( winmm => q{LRESULT waveInGetDevCaps(UINT_PTR
DeviceID, LPWAVEINCAPS pwic, UINT cbwic)} );
$devices = waveInGetNumDevs();
print "Devices: $devices\n\n";
for (0 .. ($devices - 1) ) {
$result = waveInGetDevCaps($_, $caps,
Win32::API::Struct->sizeof('WAVEINCAPS'));
print "Device ID: $_ ,ProductName: $caps->{ProductName}\n";
}
__END__;
It should return the product name of the devices (like soundblaster)
I can only get the number of the devices
Can anyone tell me what I am getting wrong?
Thanks ever so much!
#!/perl
use strict;
use warnings;
use Win32::API;
my ($caps, $devices, $result);
Win32::API::Struct->typedef( 'WAVEINCAPS', qw(
INT ManufacturerID;
INT ProductID;
LONG DriverVersion;
TCHAR ProductName[32];
LONG Formats;
INT Channels;
INT Reserved;
)) or die "Typedef error $!\n";
my $caps = Win32::API::Struct->new('WAVEINCAPS'); # Dim Caps As
WaveInCaps
Win32::API->Import( winmm => "int waveInGetNumDevs()");
Win32::API->Import( winmm => q{LRESULT waveInGetDevCaps(UINT_PTR
DeviceID, LPWAVEINCAPS pwic, UINT cbwic)} );
$devices = waveInGetNumDevs();
print "Devices: $devices\n\n";
for (0 .. ($devices - 1) ) {
$result = waveInGetDevCaps($_, $caps,
Win32::API::Struct->sizeof('WAVEINCAPS'));
print "Device ID: $_ ,ProductName: $caps->{ProductName}\n";
}
__END__;
It should return the product name of the devices (like soundblaster)
I can only get the number of the devices
Can anyone tell me what I am getting wrong?
Thanks ever so much!