user GDI APIprocedure TForm1.Button2Click(Sender: TObject);
var
BmpBits:Pointer;
FDeskHWnd:Hwnd;
SourceDC,DestDC,originHandel:integer;
i:Integer;
ABitmap:HBitmap;
BmpInfHead:TBitmapInfoHeader;
Info : TBitMapInfo;
bits:Pointer;
Apointer:Pointer;
begin
//Create DIB
Info.bmiHeader.biSize := sizeof(BITMAPINFOHEADER);
Info.bmiHeader.biWidth := WW; //width
Info.bmiHeader.biHeight := HH; //height
Info.bmiHeader.biPlanes := 1;
Info.bmiHeader.biBitCount := 16;
Info.bmiHeader.biClrUsed := 0;
Info.bmiHeader.biCompression := BI_RGB;
Info.bmiHeader.biClrImportant := 0;
ABitmap := CreateDIBSection(SourceDC, Info, DIB_RGB_COLORS, APointer, 0, 0); SourceDC:= GetDC(0);
DestDC:=CreateCompatibleDC(SourceDC);
ABitmap:=CreateCompatibleBitmap(SourceDC,WW,HH);
originHandel:=selectObject(DestDC,Abitmap);
BitBlt(DestDC,0,0,WW,HH,SourceDC,0,0,SRCCOPY);
GetDIBits(DestDC,Abitmap,0,480,Apointer,info,DIB_RGB_COLORS);
selectObject(DestDC,originHandel);
DeleteDC(DestDC);
ReleaseDC(0,SourceDC);
end;
var
BmpBits:Pointer;
FDeskHWnd:Hwnd;
SourceDC,DestDC,originHandel:integer;
i:Integer;
ABitmap:HBitmap;
BmpInfHead:TBitmapInfoHeader;
Info : TBitMapInfo;
bits:Pointer;
Apointer:Pointer;
begin
//Create DIB
Info.bmiHeader.biSize := sizeof(BITMAPINFOHEADER);
Info.bmiHeader.biWidth := WW; //width
Info.bmiHeader.biHeight := HH; //height
Info.bmiHeader.biPlanes := 1;
Info.bmiHeader.biBitCount := 16;
Info.bmiHeader.biClrUsed := 0;
Info.bmiHeader.biCompression := BI_RGB;
Info.bmiHeader.biClrImportant := 0;
ABitmap := CreateDIBSection(SourceDC, Info, DIB_RGB_COLORS, APointer, 0, 0); SourceDC:= GetDC(0);
DestDC:=CreateCompatibleDC(SourceDC);
ABitmap:=CreateCompatibleBitmap(SourceDC,WW,HH);
originHandel:=selectObject(DestDC,Abitmap);
BitBlt(DestDC,0,0,WW,HH,SourceDC,0,0,SRCCOPY);
GetDIBits(DestDC,Abitmap,0,480,Apointer,info,DIB_RGB_COLORS);
selectObject(DestDC,originHandel);
DeleteDC(DestDC);
ReleaseDC(0,SourceDC);
end;
解决方案 »
- Anybody help me???
- ADOTable访问SQL Server数据库问题
- 实在没办法了,高手都请来!
- DELPHI-数据库版快来推荐经典篇
- 显示要闪烁,怎么解决?
- 打印控制问题!!!在线等待
- 求教:有两个dbedit1和dbedit2 想当程序运行时,编辑了dbedit1中的数据后,按‘确定’后dbedit2 得到光标,然后继续编辑dbedit2.
- 给分了,为什么你老给我要分
- 三层数据库的问题,急!!!!
- 最后107悬赏Delphi高手
- 用SQL进行统计个数时出错了,请各位高手帮助!
- I:=packlist.QuickRep1.Printer.PageCount是要列印报表的总页数,但是便译时,总是显示i没赋值,没有用,是不是先要获得列印机的信息,才
var
bmpscreen:Tbitmap;
jpegscreen:Tjpegimage;
FullscreenCanvas:TCanvas;
dc:HDC;
sourceRect, destRect: TRect;
begin
dc:=getdc(0);
fullscreencanvas:=Tcanvas.Create;
fullscreencanvas.Handle:=dc;
bmpscreen:=Tbitmap.create;
bmpscreen.Width :=screen.Width ;
bmpscreen.Height :=screen.Height ;
sourcerect:=rect(0,0,screen.Width ,screen.Height );
destrect:= rect(0,0,screen.Width ,screen.Height);
bmpscreen.Canvas.CopyRect(sourcerect,fullscreenCanvas,destrect);
jpegscreen:=Tjpegimage.Create ;
jpegscreen.Assign (bmpscreen);
jpegscreen.CompressionQuality:=40;
jpegscreen.SaveToStream (jpegStream);
jpegstream.Position :=0;
LeftSize:=jpegStream.Size;
FullscreenCanvas.Free;
bmpscreen.Free;
jpegscreen.Free ;
ReleaseDC(0, DC);
end;
你的方法我也知道。
各路大虾,还需加油啊!
反正我觉得如果写一个在后台运行的服务程序,应该像个服务程序的样儿,不可以有三百多K,
多吓人,虽然现在电脑内存越来越海量,也不应该这样浪费.(人家用C写的服务程序都只有几十K
的,不过他们可恨的是有Microsoft的MFC运行库支持,不过他不支持Delphi,只有自己做). 我不害人,因为我善良。