用Directshow吧,GetCurrentImage就可以截图

解决方案 »

  1.   

    我可以 给你一个有关AVI的源程序  你的 QQ?
      

  2.   

    DWORD fccHandler = mmioFOURCC('d','i','v','x'); int biBitCount = 24;
    int m_sizeimage = width * height * (biBitCount / 8); BITMAPINFOHEADER bih;
    bih.biSize = sizeof(BITMAPINFOHEADER);
    bih.biBitCount = (WORD)biBitCount;
    bih.biWidth = width;
    bih.biHeight = height;
    bih.biSizeImage = m_sizeimage;
    bih.biCompression = fccHandler;
    bih.biPlanes = 1;
    bih.biXPelsPerMeter = 0;
    bih.biYPelsPerMeter = 0;
    bih.biClrUsed = 0;
    bih.biClrImportant = 0; WAVEFORMATEX waveFormatEx;
    memset(&waveFormatEx, 0, sizeof(WAVEFORMATEX));
    waveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
    waveFormatEx.cbSize = 0;
    waveFormatEx.nChannels = 1; //声道
    waveFormatEx.nSamplesPerSec = 16000; //采样频率
    waveFormatEx.wBitsPerSample = 16; //样本大小
    waveFormatEx.nBlockAlign = waveFormatEx.nChannels * (waveFormatEx.wBitsPerSample / 16);
    waveFormatEx.nAvgBytesPerSec = waveFormatEx.nBlockAlign * waveFormatEx.nSamplesPerSec; //每秒数据量 m_AVIRec = new CAVIRec();
    if (NULL == m_AVIRec) return false;
    HRESULT hr; 
    hr = AVIFileOpen(&m_aviFile, lpFilename, OF_WRITE | OF_CREATE, NULL); 
    if (hr != 0) {
    DiagMsg(hr);
    return FALSE;
    } if(!CreateVideoStream(m_aviFile,fccHandler,pbih,&m_strmVideo, uRate))m_strmVideo=NULL;
    if (pwfx) {
    if(!CreateAudioStream(m_aviFile, pwfx, &m_strmAudio)) m_strmAudio=NULL;
    }
    if(!CreateTextStream (m_aviFile,&m_strmCaption, uRate))m_strmCaption=NULL;

    if(m_strmVideo==NULL){
    if(m_strmCaption)AVIStreamRelease(m_strmCaption);
    if(m_strmAudio)AVIStreamRelease(m_strmAudio);
    AVIFileRelease(m_aviFile);
    return FALSE;
    } m_bOpened = TRUE;
      

  3.   

    BOOL CreateVideoStream(PAVIFILE aviFile,FOURCC fccHandler,BITMAPINFOHEADER* pbih,PAVISTREAM * ppavi, ULONG uRate)
    {
    if(pbih==NULL)return FALSE; AVISTREAMINFO strmInfoVideo;
    HRESULT hr; ZeroMemory(&strmInfoVideo, sizeof(strmInfoVideo));
    strmInfoVideo.fccType = streamtypeVIDEO;
    strmInfoVideo.fccHandler = fccHandler;
    strmInfoVideo.dwScale = 100;
    strmInfoVideo.dwRate = uRate;
    strmInfoVideo.dwStart = 0;
    strmInfoVideo.dwLength = 0;
    strmInfoVideo.dwInitialFrames = 0;
    strmInfoVideo.dwSuggestedBufferSize  = 0;
    strmInfoVideo.dwQuality  = -1;
    strmInfoVideo.dwSampleSize = 0;
    strmInfoVideo.dwEditCount = 0;
    strmInfoVideo.dwFormatChangeCount = 0;
    strmInfoVideo.dwSampleSize = 0;
    SetRect(&strmInfoVideo.rcFrame, 0, 0, (int)pbih->biWidth, (int)pbih->biHeight); PAVISTREAM strmVideo;
    hr = AVIFileCreateStream(aviFile, &strmVideo, &strmInfoVideo);
    if (hr != 0) {
    AVIFileRelease(aviFile);
    return FALSE;
    }  hr = AVIStreamSetFormat(strmVideo, 0, pbih,pbih->biSize);
    if (hr != 0) { 
    AVIStreamRelease(strmVideo); 
    return FALSE; 
    }
    *ppavi=strmVideo;
    return TRUE;
    }
      

  4.   


    能否也给我一个?谢谢
    [email protected]
      

  5.   

    你好,能否给我发一个AVI视频载入程序,411804732,谢谢了