次の方法で共有


再生ウィンドウの設定

[MCI このページに関連付けられている機能は、従来の機能です。 これは、MediaPlayerに置き換えられます。 MediaPlayer は、Windows 10 および Windows 11 用に最適化されています。 Microsoftは新しいコードで可能な場合はMCI の代わりにMediaPlayerを使用することを強くお勧めします。 従来の API を使用する既存のコードは、可能であれば新しい API を使用するように書き直すよう提案しています。

次の例では、AVI ファイルを再生するために必要なディメンションを検索し、そのサイズに対応するウィンドウを作成し、MCIAVI ドライバーを使用してウィンドウでファイルを再生します。 mciSendCommand 関数を使用します

HWND hwnd; 
MCI_DGV_RECT_PARMS mciRect; 
 
// Get the movie dimensions with MCI_WHERE. 
 
mciSendCommand(wDeviceID, MCI_WHERE, MCI_DGV_WHERE_SOURCE, 
    (DWORD)(LPSTR)&mciRect); 
 
// Create the playback window. Make it bigger for the border. 
// Note that the right and bottom members of RECT structures in MCI 
// are unusual; rc.right is set to the rectangle's width, and 
// rc.bottom is set to the rectangle's height.

hwndMovie = CreateWindow("mywindow", "Playback", 
    WS_CHILD|WS_BORDER, 0,0, 
    mciRect.rc.right+(2*GetSystemMetric(SM_CXBORDER)),
    mciRect.rc.bottom+(2*GetSystemMetric(SM_CYBORDER)), 
    hwndParent, hInstApp, NULL); 
 
if (hwndMovie){ 
    // Window created OK; make it the playback window. 
 
    MCI_DGV_WINDOW_PARMS mciWindow; 
 
    mciWindow.hWnd = hwndMovie; 
    mciSendCommand(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, 
        (DWORD)(LPSTR)&mciWindow); 
 
}