Condividi tramite


Riproduzione del file AVI

Prima di usare la funzione mciSendCommand per inviare il comando MCI_PLAY , l'applicazione alloca la memoria per la struttura, inizializza i membri che userà e imposta i flag corrispondenti ai membri usati nella struttura. Se l'applicazione non imposta un flag per un membro della struttura, i driver MCI ignorano il membro. Ad esempio, nell'esempio seguente viene riprodotto un filmato dalla posizione iniziale specificata da dwFrom alla posizione finale specificata da dwTo. Se una delle due posizioni è zero, l'esempio viene scritto in modo che la posizione non venga usata.

DWORD PlayMovie(WORD wDevID, DWORD dwFrom, DWORD dwTo) 
{ 
    MCI_DGV_PLAY_PARMS mciPlay;    // play parameters 
    DWORD dwFlags = 0; 
 
    // Check dwFrom. If it is != 0 then set parameters and flags. 
    if (dwFrom){ 
        mciPlay.dwFrom = dwFrom; // set parameter 
        dwFlags |= MCI_FROM;     // set flag to validate member 
    } 
 
    // Check dwTo. If it is != 0 then set parameters and flags. 
    if (dwTo){ 
        mciPlay.dwTo = dwTo;    // set parameter 
        dwFlags |= MCI_TO;      // set flag to validate member 
    } 
 
    // Send the MCI_PLAY command and return the result. 
    return mciSendCommand(wDevID, MCI_PLAY, dwFlags, 
       (DWORD)(LPVOID)&mciPlay); 
}