I've got a Perl/Tk application that I'm using to control WinAmp, via the
WM_COMMAND API provided by WinAmp.

To start with, if I start up WinAmp manually, and run a simple script like
this:

#####
use Win32::GUI;

$winamphandle = Win32::GUI::FindWindow("Winamp v1.x","");
print "Handle: $winamphandle\n";

Win32::GUI::SendMessage( $winamphandle, WM_COMMAND, 40045, 0 );
sleep(1);
Win32::GUI::SendMessage( $winamphandle, WM_COMMAND, 40047, 0 );
#####

It works fine.  Winamp starts and then stops a second later.

However, in my real Perl/Tk app, I can't stop WinAmp.  I start the Perl/Tk
app, and it launches WinAmp.  I've tried launching WinAmp two different
ways:

Win32::Process::Create($object, $mp3player,'',0, NORMAL_PRIORITY_CLASS, ".");

  and

open (MP3Player,"|$mp3player");

WinAmp starts fine both ways, and I can get a handle ID with:

$winamphandle = Win32::GUI::FindWindow("Winamp v1.x","");

So that part works fine.

But in a subroutine, when I try:

    print ("Stopping handle $winamphandle\n");
    Win32::GUI::SendMessage( $winamphandle, WM_COMMAND, 40047, 0 );

WinAmp doesn't stop.

So is there a difference in Win32::GUI's actions when WinAmp is launched
from within another appliction, versues when it's started manually?

Does anyone have any ideas on this problem?

Thanks,
Wade

-- 
Fight for your rights in the digital age:
http://www.speakeasy.org/~russotto/dangerous.html
http://www.digitalconsumer.org/
http://digitalspeech.org/


Reply via email to