当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 改写目的是不想一下子将媒体文件全读到内存中, 想分成小块读,所以开了个线程补充后备缓存, 在graphedit测试总是通不过,总异常退出 代码如下: #ifndef __asyncfilter_h__ #define __asyncfilter_h__ #pragma once #include "define.h" #include "asyncrdr.h&......
 ·[请邹键] 求delete语句    »显示摘要«
    摘要: 首先,我也姓邹.套点近乎先. 内容: 数据结构: id 编号 时间 101 690377b972e 2005-04-21 13:42:00 101 7a0543dad66 2005-04-21 13:42:00 101 890377b972e 2005-04-21 13:43:00 101 9a0543dad66 2005-04-21 13:43:00 102 090377b972e 2......


天啊GetDIBits把内存DC清空了,我得头都大了

1:初始化有关变量  
   
   
   
          HDC   inDC   =   CreateCompatibleDC(NULL);  
   
  BITMAPINFOHEADER   bmiHeader;  
  BITMAPINFO               bmpHeader;  
   
          int   width=300;  
  int   height=240;  
   
  bmiHeader.biSize=sizeof(BITMAPINFOHEADER);  
  bmiHeader.biWidth=width;  
  bmiHeader.biHeight=height;  
  bmiHeader.biPlanes=1;  
  bmiHeader.biBitCount=8;  
  bmiHeader.biCompression=BI_RGB;  
  bmiHeader.biSizeImage=0;  
  bmiHeader.biXPelsPerMeter=0;  
  bmiHeader.biYPelsPerMeter=0;  
  bmiHeader.biClrUsed=0;  
  bmiHeader.biClrImportant=0;  
   
   
  bmpHeader.bmiHeader=bmiHeader;  
   
  2:创建位图选入DC中  
  HBITMAP   hbm   =   CreateDIBitmap(inDC,   &bmiHeader,   0,   NULL,   NULL,   0);  
   
                    HGDIOBJ   hobj   =   SelectObject(inDC,   hbm);  
  3:得到BITMAPINFO信息  
  GetDIBits(inDC,hbm,(UINT)0,(UINT)0,NULL,(LPBITMAPINFO)&bmpHeader,DIB_RGB_COLORS);  
   
   
  然后inDC就成了0X0000000;  
   
  都两天了  
  可怎么办啊  
  请大家帮忙啊  
  谢谢  
 

NO.1   作者: liuyan4794

我按下面成粗试过,没出错  
  HDC   inDC   =   CreateCompatibleDC(NULL);  
   
  BITMAPINFOHEADER   bmiHeader;  
  BITMAPINFO               bmpHeader;  
   
          int   width=300;  
  int   height=240;  
   
  bmiHeader.biSize=sizeof(BITMAPINFOHEADER);  
  bmiHeader.biWidth=width;  
  bmiHeader.biHeight=height;  
  bmiHeader.biPlanes=1;  
  bmiHeader.biBitCount=8;  
  bmiHeader.biCompression=BI_RGB;  
  bmiHeader.biSizeImage=0;  
  bmiHeader.biXPelsPerMeter=0;  
  bmiHeader.biYPelsPerMeter=0;  
  bmiHeader.biClrUsed=0;  
  bmiHeader.biClrImportant=0;  
   
   
  bmpHeader.bmiHeader=bmiHeader;  
  HBITMAP   hbm   =   CreateDIBitmap(inDC,   &bmiHeader,   0,   NULL,   NULL,   0);  
  DWORD     dwPaletteSize=0;//调色板大小  
          HGDIOBJ   hobj   =   SelectObject(inDC,   hbm);  
  BYTE*   lbuf=new   BYTE[width*height+sizeof(BITMAPINFOHEADER)+dwPaletteSize];//假设调色板大小为0  
  *(LPBITMAPINFO)lbuf=bmpHeader;  
  GetDIBits(inDC,hbm,(UINT)0,(UINT)10,NULL,(LPBITMAPINFO)lbuf,DIB_RGB_COLORS);  
  DWORD     error_code=GetLastError();  
  delete   []lbuf;


    摘要: 我的程序遇到个怪问题,将主窗体关闭了,可在结束任务中仍然看到主程序运行中,请问各位是哪出了问题? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE