win32::api doesn't work?
From: Larry (dontmewithme_at_got.it)
Date: 01/18/05
- Next message: Jacob: "Re: How do I force a specific compiler in Configure/make"
- Previous message: Peter Billam: "Re: simple encryption/decryption"
- Next in thread: Sisyphus: "Re: win32::api doesn't work?"
- Reply: Sisyphus: "Re: win32::api doesn't work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 Jan 2005 22:47:58 GMT
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!
- Next message: Jacob: "Re: How do I force a specific compiler in Configure/make"
- Previous message: Peter Billam: "Re: simple encryption/decryption"
- Next in thread: Sisyphus: "Re: win32::api doesn't work?"
- Reply: Sisyphus: "Re: win32::api doesn't work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|