SN222 Posted January 13, 2013 Share Posted January 13, 2013 Hi there, The GetColor function gives me always -1. Here is a short sample program to make sure that there is no other mistake: program New; var x,y,c:integer; begin x:=-405 y:=122 c:=GetColor(x,y) writeln(inttostr©) end. At this position it should be 4502785, I picked it with the picking tool before. Wiki says: 'The function returns -1 if the coordinates are outside of the client's boundaries.', but that's not true since I pressed that button with the cross air. Thx for helping. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted January 13, 2013 Share Posted January 13, 2013 Use [scar] GetClient.Activate; [/scar] Before using GetColor Quote Link to comment Share on other sites More sharing options...
SN222 Posted January 14, 2013 Author Share Posted January 14, 2013 You mean like this? program New; var x,y,c:integer; begin x:=-405 y:=122 GetClient.Activate; c:=GetColor(x,y) writeln(inttostr(c)) end. I still get -1 as output. I am using version 3.38.00. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 14, 2013 Share Posted January 14, 2013 Add small wait/delay after GetClient.Activate, something like 500 ms. (Wait(500)). Quote Link to comment Share on other sites More sharing options...
SN222 Posted January 14, 2013 Author Share Posted January 14, 2013 Okay, I did this and still getting -1. :\ program New; var x,y,c:integer; begin x:=-405 y:=122 GetClient.Activate; wait(1000) c:=GetColor(x,y) writeln(inttostr(c)) end. Successfully compiled (31.4256 ms) -1 Successfully executed (1015.8109 ms) Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 14, 2013 Share Posted January 14, 2013 Okay, I did this and still getting -1. :\ program New; var x,y,c:integer; begin x:=-405 y:=122 GetClient.Activate; wait(1000) c:=GetColor(x,y) writeln(inttostr(c)) end. Successfully compiled (31.4256 ms) -1 Successfully executed (1015.8109 ms) Have you tried using GetColor for some other things, do you get same problems? Or is that problem there only with this particular game(?)? I once had similar problems with color picking, I think it was either antivirus or firewall blocking access from SCAR to screen.. Can't remember which one. -Jani - - - Updated - - - Hold on... You are picking color from: x:=-405 y:=122 x = -405, why? I think that could be your problem. Quote Link to comment Share on other sites More sharing options...
SN222 Posted January 14, 2013 Author Share Posted January 14, 2013 (edited) No, I tried the GetColor function for the first time. It does not work in my program, so I tried it in that sample above. There it does not work either. I tried to switch off the antivirus program, but I still get -1. EDIT: Yeah? But it's the position relative to that crossair button in SCAR Divi. I have my SCAR in the right corner, so when I go to the left with my mouse and pick the coordinates, they are negative relative to my SCAR window. Edited January 14, 2013 by SN222 Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 14, 2013 Share Posted January 14, 2013 No, I tried the GetColor function for the first time. It does not work in my program, so I tried it in that sample above. There it does not work either. I tried to switch off the antivirus program, but I still get -1. Fix your x-coordinate, that is the problem. You are using negative x-coordinate (-405). Quote Link to comment Share on other sites More sharing options...
SN222 Posted January 14, 2013 Author Share Posted January 14, 2013 (edited) Sorry, see edit above. EDIT: Worked, but why? ^^ So the GetColor function uses the resolution of the screen (the pixels) as coordinates? Why not the clickmouse function? Thank you so much. Edited January 14, 2013 by SN222 Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 14, 2013 Share Posted January 14, 2013 Sorry, see edit above. EDIT: Worked, but why? ^^ So the GetColor function uses the resolution of the screen (the pixels) as coordinates? Why not the clickmouse function? Thank you so much. Yeah, sadly I have no idea why it doesn't work with negatives (even if that negative coordinate is still inside the screen area!), where as colorpicker does... But yeah, I think this is something Freddy has to give an answer for, he is the only one who knows.It definitely would be great to have those color functions work outside targeted client aswell, hmm... ..maybe it's a bug? Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 14, 2013 Share Posted January 14, 2013 GetColor and all other color related functions, pull the color data from the device context of the window in the event that you're using a regular window client. The device context is essentially where the window draws itself to, but it's window-specific, so the device context of window A won't contain any content from window B. If you want the content of every window, you have to use the device context of the desktop. Of coruse, if you do this, the window(s) you're targeting with the color functions must be on top, where as with the regular device context approach, the only requirement is that they are not minimized. If you want to use this approach, you can try this code: http://forums.scar-divi.com/showthread.php?1860-Client-Problem&p=11476&viewfull=1#post11476 Quote Link to comment Share on other sites More sharing options...