mci

why mciSendString() to get status position fails in my code?


Is there any way to query mci device to query current playing position so that we can resume from there to play later on ?

cmd.Format(L"status %d waveaudio position",m_iDeviceIDPlayer);

mcirez = mciSendString(cmd,buff.GetBuffer(),1024, NULL);

it gives this error : "The specified device is not open or is not recognized by MCI "

Is there any problem with command ?


Solution

  • MCI_STATUS_PARMS status;
    status.dwItem = MCI_STATUS_POSITION;
    status.dwCallback = 0;
    
    dwReturn = mciSendCommand(m_iDeviceIDPlayer,MCI_STATUS,MCI_STATUS_ITEM|MCI_WAIT,(DWORD_PTR)&status);     
    

    Position -> status.dwReturn is the required position.