要使用DrawDibDraw函数,需要这个玩意,目前在GOOGLE上找到CreateDIBSection这个函数可以得到,但是始终不成功~~~,希望大家赐教,谢谢

解决方案 »

  1.   

    网上有做好了的DIB类,Search...
      

  2.   

    你要用DrawDibDraw画什么?
    这个例子我倒是写过,但是我不知道你想怎么画啊~
      

  3.   

    原来是用AVIStreamGetFrame得到内存地址(就是AVIStreamGetFrame的返回值我在网络上查的~~是)
    然后把得到的内存地址传输给DrawDibDraw,然后进行操作,我现在的目的是将其换成本地的BMP文件~~~我后来用CreateDIBSection想得到同样的地址,然后传输给DrawDibDraw,最后输出GIF为文件,但是总是不对~~~不知道我的描述是否明白,很想用GDI+,但是却必须要这样做没有办法啊~~~
    谢谢楼上的兄弟帮忙看看啊
      

  4.   

    address = AVIStreamGetFrame(ByVal ToGif, lFrame - 1)lRet = DrawDibDraw(lhDrawDIB, oBuffDIB.hDC, 0, 0, oBuffDIB.Width, oBuffDIB.Height, ByVal address, ByVal 0, 0, 0, -1, -1, 0)
      

  5.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_233i.aspCreateDIBSection 根本不是这么用的啊
      

  6.   

    http://www.codeproject.com/audio/ExtractAVIFrames.asp?df=100&forumid=124336&exp=0&select=1617655这个代码就是你要的功能了
      

  7.   

    谢谢 VirtualDesktop(吴滂:欢迎到我的Blog转转 ^_^) 。不过我不是要实现这个功能~~~~,您是否有含有 DrawDibDraw函数和CreateDIBSection函数 的VB的例子,就是利用CreateDIBSection得到内存地址的最简单的例子么~~如果分不够可以再开帖子~~
    谢谢
      

  8.   

    这种事还是用VC吧
    DrawDibDraw
    The DrawDibDraw function draws a DIB to the screen.BOOL DrawDibDraw(
      HDRAWDIB hdd,             
      HDC hdc,                  
      int xDst,                 
      int yDst,                 
      int dxDst,                
      int dyDst,                
      LPBITMAPINFOHEADER lpbi,  
      LPVOID lpBits,            
      int xSrc,                 
      int ySrc,                 
      int dxSrc,                
      int dySrc,                
      UINT wFlags               
    );
     
    Parameters
    hdd 
    Handle of a DrawDib DC. 
    hdc 
    Handle of the DC. 
    xDst and yDst 
    The x- and y-coordinates, in MM_TEXT client coordinates, of the upper left corner of the destination rectangle. 
    dxDst and dyDst 
    Width and height, in MM_TEXT client coordinates, of the destination rectangle. If dxDst is – 1, the width of the bitmap is used. If dyDst is – 1, the height of the bitmap is used. 
    lpbi 
    Address of theBITMAPINFOHEADER structure containing the image format. The color table for the DIB within BITMAPINFOHEADER follows the format and the biHeight member must be a positive value; DrawDibDraw will not draw inverted DIBs. 
    lpBits 
    Address of the buffer that contains the bitmap bits. 
    xSrc and ySrc 
    The x- and y-coordinates, in pixels, of the upper left corner of the source rectangle. The coordinates (0,0) represent the upper left corner of the bitmap. 
    dxSrc and dySrc 
    Width and height, in pixels, of the source rectangle. 
    wFlags 
    Applicable flags for drawing. The following values are defined: 
    DDF_BACKGROUNDPAL 
    Realizes the palette used for drawing in the background, leaving the actual palette used for display unchanged. This value is valid only if DDF_SAME_HDC is not set. 
    DDF_DONTDRAW 
    Current image is decompressed but not drawn. This flag supersedes the DDF_PREROLL flag. 
    DDF_FULLSCREEN 
    Not supported. 
    DDF_HALFTONE 
    Always dithers the DIB to a standard palette regardless of the palette of the DIB. If your application uses the DrawDibBegin function, set this value in DrawDibBegin rather than in DrawDibDraw. 
    DDF_HURRYUP 
    Data does not have to be drawn (that is, it can be dropped) and DDF_UPDATE will not be used to recall this information. DrawDib checks this value only if it is required to build the next frame; otherwise, the value is ignored. 
    This value is usually used to synchronize video and audio. When synchronizing data, applications should send the image with this value in case the driver needs to buffer the frame to decompress subsequent frames. DDF_NOTKEYFRAME 
    DIB data is not a key frame. 
    DDF_SAME_HDC 
    Use the current DC handle and the palette currently associated with the DC. 
    DDF_SAME_DRAW 
    Use the current drawing parameters for DrawDibDraw. Use this value only if lpbi, dxDst, dyDst, dxSrc, and dySrc have not changed since using DrawDibDraw or DrawDibBegin. DrawDibDraw typically checks the parameters, and if they have changed, DrawDibBegin prepares the DrawDib DC for drawing. This flag supersedes the DDF_SAME_DIB and DDF_SAME_SIZE flags. 
    DDF_UPDATE 
    Last buffered bitmap is to be redrawn. If drawing fails with this value, a buffered image is not available and a new image needs to be specified before the display can be updated. 
    Return Values
    Returns TRUE if successful or FALSE otherwise.Res
    DDF_DONTDRAW causes DrawDibDraw to decompress but not display an image. A subsequent call to DrawDibDraw specifying DDF_UPDATE displays the image. If the DrawDib DC does not have an off-screen buffer specified, specifying DDF_DONTDRAW causes the frame to be drawn to the screen immediately. Subsequent calls to DrawDibDraw specifying DDF_UPDATE fail. Although they are set at different times, DDF_UPDATE and DDF_DONTDRAW can be used together to create composite images off-screen. When the off-screen image is complete, you can display the image by calling DrawDibDraw.
      

  9.   

    我晕了CreateDIBSection不是这样用的阿
    CreateDIBSection是用来建立一幅位图的,然后才能得到它的地址
    如果已经有位图,就不是这样做的了
      

  10.   

    你现在DrawDibDraw画出来之后再想办法保存成gif不可以么?