M
m8858
Unregistered / Unconfirmed
GUEST, unregistred user!
//想让下面这个程序编译出来以后大小在20kb以下! 有兴趣的加我 Q Q 4 9 1 3 8 8 2 4 4 支持支付宝 农行{tu.dpr}program tu;uses Windows, //只保留这个单元的话 程序会在20kb以内 Graphics, SysUtils, Jpeg;function PrintWindow(SourceWindow: hwnd; Destination: hdc; nFlags: cardinal): bool; stdcall; external 'user32.dll' name 'PrintWindow';procedure JieTu(); stdcall;var bmp : TBitmap; wnd : cardinal; Jpg:Tjpegimage; rec : TRect;begin wnd := FindWindow(nil, '计算器'); if wnd <> 0 then begin GetWindowRect(wnd, rec); bmp := TBitmap.Create; try bmp.Width := rec.Right - rec.Left; bmp.Height := rec.Bottom - rec.Top; bmp.PixelFormat := pf16bit; PrintWindow(wnd, bmp.Canvas.Handle, 0); Jpg:=Tjpegimage.Create ; Jpg.Assign (bmp); Jpg.CompressionQuality:=100; Jpg.SaveToFile(ExtractFilePath(ParamStr(0))+'tmp.jpg'); bmp.Free; Jpg.Free; finally bmp.Free; Jpg.Free; end; end;end;begin JieTu;end.