joker0927 has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a remote admin program in perl. I can do everything I want to do except load a file into the playlist. Here is an example written in C from the winamp api page.

COPYDATASTRUCT cds; cds.dwData = id; cds.lpData = (void*)data; cds.cbData = data_length; SendMessage(hwndWinamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);

Does anyone know how to do this in perl. I want to learn C eventually, but I really don't want to take the time to learn it right now. I'm still learning perl :-)

I'm thinking this looks a lot like a hash, and I have SendMessage via Win32::GUI. Although, I DON'T think it has WM_COPYDATA.

I know I could make a xs sub, but from the little I've read about it so far, it seems as though I would have to learn a fair amount of C to do that too.

Is it possible to do this using only perl? Any feedback will be appreciated.

Replies are listed 'Best First'.
Re: loading a file in winamp using perl
by nite_man (Deacon) on May 20, 2003 at 06:05 UTC
    Try to use a module Winamp::Control from CPAN.
    May the CPAN help us.
          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);
    
      I guess I should've specified that I'm trying to implement this as a cgi script. I've used programs that are designed like the Winamp::Control program, and if Winamp crashes you just out of luck. The idea is to implement this as a cgi script and use system to launch winamp if needed.

      Alas, it appears I may have to resort to this if I don't want to learn c right now. Maybe I'll try to figure out how to modify Winamp::Control to use a CGI interface instead of the httpQ plugin.

      So, my original question still stands.

        It sounds like I have just the code you're looking for. Unfortunately it's: (a) Not finished and (b) Stored on my laptop meaning it'll take me a little while to find it.

        It uses Win32::API to send calls directly to the Winamp window. It only works with Winamp 2. I'll post it here once I get my laptop out and remember where I've stored it.

        --
        Grant me the wisdom to shut my mouth when I don't know what I'm talking about.

        Well, I finally managed to dig up the code but it turns out I was stuck at the same place you were. It doesn't add files but it does just about everything else. I can still post it if you'd like to take a look.

        --
        Grant me the wisdom to shut my mouth when I don't know what I'm talking about.