here is my complete code
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,LCLIntf;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
function ScreenColor(aX, aY: integer):TColor;
var
ScreenDC: HDC;
SaveBitmap: TBitmap;
begin
SaveBitmap := TBitmap.Create;
try
SaveBitmap.SetSize(Screen.Width, Screen.Height);
ScreenDC := GetDC(0);
try
SaveBitmap.LoadFromDevice(ScreenDC);
finally
ReleaseDC(0, ScreenDC);
end;
Result := SaveBitmap.Canvas.Pixels[aX, aY];
finally
SaveBitmap.Free;
end;
end;
end.
Im trying to use your example but its the following errors.
unit1.pas(38,16) Error: Identifier not found "HDC"
unit1.pas(38,16) Error: Error in type definition
unit1.pas(46,41) Error: Incompatible type for arg no. 1: Got "<erroneous type>", expected "HDC"
rasterimage.inc(342,24) Hint: Found declaration: TRasterImage.LoadFromDevice(HDC);
unit1.pas(48,28) Error: Incompatible type for arg no. 2: Got "<erroneous type>", expected "HDC"
winapi.inc(798,10) Hint: Found declaration: ReleaseDC(HWND,HDC):LongInt;
unit1.pas(58) Fatal: There were 4 errors compiling module, stopping