Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Calling a C API in a dll from Perl on Windows

by fenonn (Chaplain)
on Jun 24, 2002 at 15:55 UTC ( #176838=note: print w/replies, xml ) Need Help??


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';

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://176838]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2016-09-28 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (540 votes). Check out past polls.