win32::api doesn't work?

From: Larry (dontmewithme_at_got.it)
Date: 01/18/05


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!



Relevant Pages

  • Win32::api doesnt work?
    ... INT ManufacturerID; ... INT ProductID; ... LONG Formats; ... INT Channels; ...
    (comp.lang.perl.misc)
  • Re: Options when it comes to searching dates?
    ... declare @date int ... declare @time int ... You must parse and then be ... > Can I assume that you are referring to free-form date formats, ...
    (microsoft.public.sqlserver.fulltext)
  • Re: GDI+ Image::Save() function returns InvalidParameter
    ... If that fails, ... It should be image data in one of the formats GDI+ understands, ... massage it into one of the formats compatible with Windows bitmaps, ... could use Bitmapor Bitmap(int, int, int, ...
    (microsoft.public.vc.language)
  • Re: Using VisualBasic 6 Random Access Files in dotnet
    ... formats haven't. ... int oh_here; ... I tought all data in a file where binary data... ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Files, Chars and Bytes..
    ... unsigned int Len; // Remaining chunk length after this header ... short int Channels; // Number of channels ... int Rate; // Sampling rate ... int BytesPerSec; // Bytes per second ...
    (comp.lang.java.help)