请教个问题,使用过DSPack这个控件吗?为什么在64位操作系统使用SampleGrabber1.GetBitmap(Image1.Picture.Bitmap) ;取不到图像
我把这个抓取到的图片保存了本地目录上的test.bmp,但是这个test.bmp不是有效的图像文件,但是在32位操作系统中同样的代码,却没有任何问题,真不知道该如果处理,各位大侠帮帮忙,谢谢了!

解决方案 »

  1.   

    代码贴出来,以备其他的朋友需要,直接在里面写了个函数:
    function TGetFromCap2Form.capturescreenrect(arect: trect): tbitmap;
    var screendc:hdc;   //设备描述表的句柄
    begin
     result:=tbitmap.create ;
     with result,arect do
     begin
       width :=right-left;
       height:=bottom-top;
       screendc:=getdc(0); //获取一个窗口的设备描述表的句柄,0参数返回屏幕窗口设备描述表的句柄
       try
         //bool bitblt(hdcdest,nxdest,nydest,nwidth,nheight,hdcsrc,nxsrc,nysrc,dwrop)
         //把位图从源设备描述表hdcsrc复制到目标设备描述表hdcdest,
         //光栅操作码dwrop指定了 源图的组合方式
         bitblt(canvas.handle ,0,0,width,height,screendc,left,top,srccopy);
       finally
         releasedc(0,screendc);
       end;
     end;function TGetFromCap2Form.captureclientimage(control: tcontrol): tbitmap;
    begin
     //control.clientorigin是控件客户区的左上角位置。x,y是 clientorigin的变量
     with control,control.clientorigin do
       result:=capturescreenrect(bounds(x,y+StrToInt(S_Hight.Text),clientwidth,clientheight-StrToInt(X_Hight.Text)));
    end;
    end;