1

Try ro find song duration like HH:MM:SS for showing in my program.

Try to use

[DllImport("winmm.dll")]
    private static extern long mciSendString(string strCommand,
        StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);

with

public int CurrentTime()
    {
        MPlayerCommand = "status MediaFile length track number";
        error = mciSendString(MPlayerCommand, returnData, 128, IntPtr.Zero);
        return Convert.ToInt32(returnData.ToString());
    }

But as result get error - "incorrect input string"

Use for understanding this. As I understand for getting song length need to use command status MediaFile length track number, where status - main command, MediaFile - tell to use current opened MediaFile, length track number - requested parameter. Use this method only after opening file.

hbk
  • 10,908
  • 11
  • 91
  • 124

1 Answers1

0

I know that's an old question, but I think you've misread the documentation, length track number meant to be replaced by length track 1, length track 2, ... where number is the actual track # :)

DarkUrse
  • 2,084
  • 3
  • 25
  • 33