http://www.perlmonks.org?node_id=176838


in reply to Calling a C API in a dll from Perl on Windows

I think the best bet is to go with using Win32::API. I have used this module to easily allow my perl program to control Winamp. Here is a short example that uses a function in the user32.dll to send a Win32 message to Winamp to obtain its playback status.
#!/usr/bin/perl -w use strict; use Win32::GUI; use Win32::API; my $winampHandle = Win32::GUI::FindWindow("Winamp v1.x", ""); print "Handle: $winampHandle\n"; my $sendMessage = new Win32::API("user32", "SendMessageA", ['N','N','N +','N'], 'N'); my $playStatus = $sendMessage->Call($winampHandle,1024,2,104); print $playStatus == 0 ? 'stopped' : $playStatus == 1 ? 'playing' : 'p +aused';