Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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?
Discipulus without Corion and with choroba in another timezone the monastery was silent.. I was silbing alone in the cloister
[choroba]: Yes, I feel alone in the cyberspace...
[choroba]: Not many occasions to talk to my wife, either :-(
Discipulus s/silbing/whistle/ dunno from where this word was in my mind..
[Discipulus]: lost in time in space and in the meaning (rocky horror picture show)
[Corion]: Discipulus: Yeah, a short vacation on the Canary islands (Lanzarote). Always great to be in the warmth and sun, from a cold and rainy February here ;)
[Corion]: choroba: Yeah, you have to find a time for the regular skype (or whatever) meetup, I imagine that's hard

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2017-02-22 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (325 votes). Check out past polls.