VC implementation AVI, MID, MP3, ASF, WMA player core code

xiaoxiao2021-03-06  91

Void MediaPlayerdlg :: Play (cstring psing) {extname = getExt (psing); if (extname == "jpg" | extName == "bmp" | extName == "gif") {PAPP-> OpenDocumentFile (PSING); Playing; = TRUE;} else {m_pParent-> ShowWindow (SW_HIDE); mciopenparms.lpstrElementName = psing; mciopenparms.lpstrDeviceType = NULL; mciSendCommand (0, MCI_OPEN, MCI_DEVTYPE_WAVEFORM_AUDIO, (DWORD) (LPVOID) & mciopenparms); m_count = mciopenparms.wDeviceID; mciplayparms .dwCallback = (DWORD) GetSafeHwnd (); cdlen = getinfo (MCI_STATUS_LENGTH); if (playing == TRUE) cdfrom = MCI_MAKE_HMS (0,0,0); cdto = MCI_MAKE_HMS (MCI_HMS_HOUR (cdlen), MCI_HMS_MINUTE (cdlen), MCI_HMS_SECOND (cdlen); mciplayparms.dwfrom = cdfrom; mciplayparms.dwto = cdto; mcisndcommand (m_count, mci_play, mci_to | mci_from, (dword) (LPVOID) & mcIPlayP ARMS); Settimer (0, 1000, NULL); m_slider.setRange (0, CDLEN); Playing = true; // Calculate song play time second = CDLEN / 1000; minite = second / 60; second = second% 60; Singtime; SINGTIME .Format ("% 02d: 02d", minite, second);

} DWORD MediaPlayerDlg :: getinfo (DWORD item) {mcistatusparms.dwCallback = (DWORD) GetSafeHwnd (); mcistatusparms.dwItem = item; mcistatusparms.dwReturn = 0; mciSendCommand (m_count, MCI_STATUS, MCI_STATUS_ITEM, (DWORD) & mcistatusparms); return mcistatusparms .dwreturn;

void MediaPlayerDlg :: OnButtonpause () {// TODO: Add your control notification handler code here KillTimer (0); DWORD dwsf = getinfo (MCI_STATUS_POSITION); cdfrom = MCI_MAKE_MSF (MCI_MSF_MINUTE (dwsf), MCI_MSF_SECOND (dwsf), MCI_MSF_FRAME (dwsf) ); MCISENDCOMMAND (m_count, mci_close, 0, null); m_count = 0; playing = false;}

转载请注明原文地址:https://www.9cbs.com/read-105088.html

New Post(0)