I'd like to use GetPixelColor> with the cursor coordinates being Relative to the window instead of the absolute coordinates from the screen. My solution currently is to maximize the user's app to be sure I hit the same point with GetPixel.
Ideas?
thanks,
Paul
Relative vs. Absolute Cursor Position
Moderators: JRL, Dorian (MJT support)
Hi,
Just get the X,Y coords of the window. Then add the relative position to these to get absolute X,Y coords and use these in GetPixelColor. E.g:
Let>relX=50
Let>relY=50
SetFocus>notepad*
GetActiveWindow>win,winX,winY
Let>absX=winX+relX
Let>absY=winY+relY
GetPixelColor>absX,absY,pcolor
This would get the pixel color of the pixel at position 50,50 relative to Notepad's top left corner.
Just get the X,Y coords of the window. Then add the relative position to these to get absolute X,Y coords and use these in GetPixelColor. E.g:
Let>relX=50
Let>relY=50
SetFocus>notepad*
GetActiveWindow>win,winX,winY
Let>absX=winX+relX
Let>absY=winY+relY
GetPixelColor>absX,absY,pcolor
This would get the pixel color of the pixel at position 50,50 relative to Notepad's top left corner.
MJT Net Support
[email protected]
[email protected]