CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MCI commands

  1. #1
    Join Date
    May 1999
    Location
    Sweden
    Posts
    55

    MCI commands

    Hi,

    I hope someone can help me out with som MCI-programming. I have made a small app that is going to play a mpegmovie using mci-commands. The problem I have is that I wont get it to play in the dialog I have created for it. How can I do this. I have tried to pass in the handle for dialog but that wont do it. Any suggestions?

    Here´s the code for it so far, one function too open the device, one to load the file and one to play the file.



    [
    BOOL CDigitalVideo::Open(HWND hWnd)
    {

    if( m_bOpened )
    return( TRUE );

    m_bPaused = m_bPlaying = FALSE;
    m_wDeviceID = 0;

    MCI_DGV_OPEN_PARMS OpenParms;
    OpenParms.lpstrDeviceType = "mpegvideo";
    OpenParms.wDeviceID = 0;
    OpenParms.hWndParent = hWnd; //
    OpenParms.dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;

    if( mciSendCommand( 0, MCI_OPEN, MCI_OPEN_TYPE |MCI_DGV_OPEN_PARENT|
    MCI_DGV_OPEN_WS | MCI_WAIT ,(DWORD)(LPVOID) &OpenParms ) )
    return( FALSE );

    m_wDeviceID = OpenParms.wDeviceID;
    m_bOpened = TRUE;

    MCI_DGV_SET_PARMS SetParms;
    SetParms.dwTimeFormat = MCI_FORMAT_MSF;
    //SetParms.dwFileFormat = MCI_DGV_FF_MPEG;

    if( mciSendCommand( m_wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT /*|
    MCI_DGV_SET_FILEFORMAT */| MCI_WAIT,
    (DWORD)(LPVOID) &SetParms ) )
    {
    Close ();
    return( FALSE );
    }

    return( TRUE );

    }

    BOOL CDigitalVideo::LoadFile(LPSTR lpstrFileName/*, HWND hWnd*/)
    {
    if(!m_bOpened)
    return( FALSE );

    MCI_DGV_LOAD_PARMS LoadParms;
    LoadParms.lpfilename = (LPSTR)lpstrFileName;

    if(mciSendCommand(m_wDeviceID, MCI_LOAD, MCI_LOAD_FILE,
    (DWORD)(LPVOID) &LoadParms ))
    return( FALSE );

    return (TRUE);
    }

    BOOL CDigitalVideo::Play (HWND hWnd)
    {

    if( !Open(hWnd) )
    return( FALSE );

    MCI_DGV_PLAY_PARMS PlayParms;

    PlayParms.dwFrom = MCI_MAKE_MSF( GetMinutes(), GetSeconds(), GetFrames());

    if( mciSendCommand( m_wDeviceID, MCI_PLAY, MCI_FROM ,
    (DWORD)(LPVOID) &PlayParms ) )
    return( FALSE );

    m_bPaused = FALSE;
    m_bPlaying = TRUE;

    return( TRUE );

    }
    ]


  2. #2
    Join Date
    May 1999
    Location
    Sweden
    Posts
    55

    Re: MCI commands

    Hmm, I´ve been having trouble getting this to work for a long time now, and I need to get this to work by tuesday. Can anyone please help me out here?

    Regards Frederik.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured