我用API函数mciSendString做了一个MP3文件的程序,基本的功能已经实现在,现在有一个问题,我想通过一个播放的进度条来调整播放MP3的进度,请问怎么通过API函数mciSendString获得MP3文件需要的总时间及当前播放时间,还有就是设置到指定点开始播放!!!
  不要告诉我用什么控件获得,要用API函数mciSendString获得MP3文件需要的总时间及当前播放时间。
  我对API函数mciSendString不大了解,那位大侠有这方面的资料!!也可以!!

解决方案 »

  1.   

    mciSendString
    The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string. MCIERROR mciSendString(
      LPCTSTR lpszCommand,  
      LPTSTR lpszReturnString,  
      UINT cchReturn,       
      HANDLE hwndCallback   
    );
    Parameters
    lpszCommand 
    Pointer to a null-terminated string that specifies an MCI command string. For a list, see Multimedia Command Strings. 
    lpszReturnString 
    Pointer to a buffer that receives return information. If no return information is needed, this parameter can be NULL. 
    cchReturn 
    Size, in characters, of the return buffer specified by the lpszReturnString parameter. 
    hwndCallback 
    Handle to a callback window if the "notify" flag was specified in the command string. 
    Return Values
    Returns zero if successful or an error otherwise. The low-order word of the returned DWORD value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see MCIERR Return Values.To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString function. 
      

  2.   

    自己看帮助吧顺便问一下,“不要告诉我用什么控件获得,要用API函数mciSendString获得MP3文件需要的总时间及当前播放时间。”要是它没有返回你要的那些信息,你也非要它有?
      

  3.   

    dim musicLength as Long
    dim sLength as String * 128
    dim lReturn as LonglReturn = mciSendString("Status " & oAlias & " length", sLength, 128, 0)
    Slider1.Max = Val(sLength)
    musicLength = Slider1.Max / 1000  '歌曲总长度(秒)通过进度条来调整播放进度
    mciSendString "Play " & sAlias & " From " & Slider1.Value, "", 0, 0