共用方式為


變更播放狀態

[與此頁面相關聯的功能 MCI是舊版功能。 MediaPlayer已取代它。 MediaPlayer 已針對 Windows 10 和 Windows 11 優化。 Microsoft強烈建議新程式代碼盡可能使用 MediaPlayer,而不是 MCI。 Microsoft建議使用舊版 API 的現有程式代碼,盡可能改寫成使用新的 API。]

下列範例示範如何使用 暫停繼續停止,以及 mciSendString 函式中搜尋 命令。

// Assume the file was opened with the alias 'movie'. 
 
// Pause play. 
mciSendString("pause movie", NULL, 0, NULL); 
 
// Resume play. 
mciSendString("resume movie", NULL, 0, NULL); 
 
// Stop play. 
mciSendString("stop movie", NULL, 0, NULL); 
 
// Seek to the beginning. 
mciSendString("seek movie to start", NULL, 0, NULL); 
 

下列範例示範如何變更搜尋模式:

// Set seek mode with the string interface. 
// Assume the file was opened with the alias 'movie'. 
 
void SetSeekMode(BOOL fExact) 
{ 
    if (fExact) 
        mciSendString("set movie seek exactly on", NULL, 0, NULL); 
    else 
        mciSendString("set movie seek exactly off", NULL, 0, NULL); 
}