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.