Ok, Im looking to get the pixel color of a certain pixel, but i dont understand the first parameter or GetPixel();
http://msdn.microsoft.com/en-us/library/ms532282.aspx
I dont know what to do for the HDC(i dont even know what HDC is).
Printable View
Ok, Im looking to get the pixel color of a certain pixel, but i dont understand the first parameter or GetPixel();
http://msdn.microsoft.com/en-us/library/ms532282.aspx
I dont know what to do for the HDC(i dont even know what HDC is).
A HDC is a Handle for a Display Context. You can get one with a CreateDC() or GetDC() - depending on what you are actually trying to do.
--
Mats
i just want to get the color of a pixel on screen. Ill Go check it out, thanks.
Well,i read a whole bunch on the msdn site, i cant find it out at all... im gonna try to find some other way i guess
So, if you explain what you want to do (with a bit more detail than "I want to read a pixel"). For example, would it be sufficient to read pixels from the entire screen (as in, do you know where on the screen your pixels are)?
If so,should do the trick.Code:HDC hdc = GetDC(NULL);
GetPixel(hdc, ...);
--
Mats
I tried using HDC, my compiler didnt recognize it, so there must be something wrong with the registers. I found out how to do it in pascal anyway,
For Some reason, CTRL+ALT+R isnt making the program run, so i can only get the color of the start icon on the compilerCode:program ColorFinder;
var color,x,y: integer;
procedure findcolor;
begin
GetMousePos(x,y);
color:=GetColor(x,y);
writeln('color='+ IntToStr(color));
end;
begin
findcolor;
end.
I have absolutely no idea what CTRL-ALT-R is supposed to do here. Perhaps you can post your C++ attempt?
--
Mats
Lolz, when i go to the run part on my pascal compiler it says CTRL+ALT+R should make it run. Oh well.... I have alot of different attempts, I know they where all wrong. Pascal is a much easier language than C, I might learn C a bit later in my career, but im just going to stick to pascal for now.
EDIT: I changed the hotkey to CTRL+ALT+B and now it works, lolz, thats wierd.
EDIT: I have enchanced my code so that is now prints:
Color=whatevercolor(x,y)
Code:program ColorFinder;
var color,x,y : integer;
z,a,b: string;
procedure findcolor;
begin
z:= '(';
a:= ',';
b:= ')';
GetMousePos(x,y);
color:=GetColor(x,y);
writeln('color = '+IntToStr(color)+(z)+IntToStr(x)+(a)+IntToStr(y)+(b));
end;
begin
findcolor;
end.