[MCI 이 페이지와 연결된 기능은 레거시 기능입니다. 이 MediaPlayer로 대체되었습니다. MediaPlayer Windows 10 및 Windows 11에 최적화되었습니다. 가능한 경우 새 코드에서 MCI 대신 MediaPlayer 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]
다음 예제 함수는 mciSendString 함수를 사용하여 "from" 및 "to" 플래그를 사용하여 play 명령을 보냅니다.
BOOL PlayFromTo(LPTSTR lpstrAlias, DWORD dwFrom, DWORD dwTo)
{
TCHAR achCommandBuff[128];
int result;
MCIERROR err;
// Form the command string.
result = _stprintf_s(
achCommandBuff,
TEXT("play %s from %u to %u"),
lpstrAlias, dwFrom, dwTo);
if (result == -1)
{
return FALSE;
}
// Send the command string.
err = mciSendString(achCommandBuff, NULL, 0, NULL);
if (err != 0)
{
return FALSE;
}
return TRUE;
}