I would try using the older wheel Win32::MCI::Basic / Win32::MCI::CD , it comes with mciGetErrorString

site:perlmonks.org Win32::MCI -> Get CDDB info on Win32

update: And it works on WinXP :)

#!/usr/bin/perl -- use strict; use warnings; use Win32::MCI::Basic; Main( @ARGV ); exit( 0 ); sub Main { my $sFileName = shift or die "Usage: $0 C:\media\sh-boom.mp3 \n"; Shabba( qq{open "$sFileName" alias MediaFile } ); # OK! ## http://msdn.microsoft.com/en-us/library/ms709461%28v=VS.85%29.aspx# + MCI my $length = Shabba( qq{status MediaFile length } ); Shabba( qq{play MediaFile from 0 } ); my $position = Shabba( qq{status MediaFile position} ); while ( $position < $length ){ sleep 1; $position = Shabba( qq{status MediaFile position} ); } Shabba( qq{close MediaFile } ); } sub Shabba { my $lpszCommand = shift; my ( $APICallReturnValue, $lpszReturnString ) = mciSendString($lps +zCommand); my $lpszErrorText = mciGetErrorString( $APICallReturnValue ); no warnings 'uninitialized'; print " \$lpszCommand : $lpszCommand \$APICallReturnValue : $APICallReturnValue \$lpszReturnString : $lpszReturnString \$lpszErrorText : $lpszErrorText ---- "; return $lpszReturnString ; } __END__

update: Win32::MediaPlayer has $mciSendString = new Win32::API( "winmm", "mciSendString", ['P', 'P', 'N', 'N'], 'N' )

Where as Win32::MCI::Basic has  new Win32::API('winmm',    'mciSendString',    ['P','P','I','P'],    'N');

Sometimes old wheels are better :)


In reply to Re: Win32::MediaPlayer not playing sound by Anonymous Monk
in thread Win32::MediaPlayer not playing sound by TROGDOR

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.