mciSendString - length of a track

Tech-Archive recommends: Fix windows errors by optimizing your registry



HI

The mciSendString returns different value of tracks length than
winamp. The value is longer about 20 seconds and I don't know why.
Here is a code:

public void SetTime() // I tried to set time format as it is said in
MSDN help but it dosent work
{
sCommand = "set MediaFile time format hms";
mciSendString(sCommand, null, 0, IntPtr.Zero);
}
public int TrackLength()
{
Open(pathPlay); // here I open file (with whole path)
which length should be checked
//SetTime();
sCommand = "status MediaFile length";
int i = 128;
System.Text.StringBuilder stringBuilder = new
System.Text.StringBuilder(i);
mciSendString(sCommand, stringBuilder, i,
IntPtr.Zero);
return System.Convert.ToInt32(stringBuilder.ToString());
}

The value is returned in ms. Any ideas?? Or maybe I should use
different function to check the length??
Here is the link which help me a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_status_mm.asp

KK

.



Relevant Pages

  • Re: mciSendString - length of a track
    ... MSDN help but it dosent work ... public int TrackLength() ... System.Text.StringBuilder stringBuilder = new ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Marshalling Unmanaged DLL
    ... > I've really flailed at this today, and read many posts and MSDN help ... > static extern int oziGetExePath ... In examples I do not see the StringBuilder passed by reference. ...
    (microsoft.public.dotnet.languages.csharp)