Page 1 of 1

GetPixel app

Posted: Sat Mar 09, 2013 5:16 pm
by cvirus
Hey Marco, sorry for ask but can you explain a bit this code of yours?

I mean, why all this api`s Calls? Are they needed?

Thanks

const vbKeyLButton=1``left mouse button

Declare GetPixel as "GetPixel" of "gdi32"
  hdc As Long
  x As Long
  y As Long
  result As Long
end declare

declare getdesk as "GetDesktopWindow" of user32
  result as integer
end declare

declare getdc as "GetWindowDC" of user32
  handle as integer
  result as integer
end declare

Declare GetAsyncKeyState as "GetAsyncKeyState" of "user32"
  vKey As Long
  result As Integer
end declare


GetPixel app

Posted: Sun Mar 10, 2013 4:44 pm
by Marco
getpixel gets the color of a place on the screen, desktop, not only the form that is active. 
getdesktopwind finds the window handle of the desktop to use in combination with getdc. this dc (device context) is used with getpixel.
The above is used to get a pixelcolor at any place of the desktop. Also outside the application form or inside a third party application form.

Getsynckey is only used for pressing the mouse button, because a mousedown event will only work inside the aplication form.
So they are all needed to get a pixelcolor anywhere at the desktop.

i hope this will explain it. Best regards

GetPixel app

Posted: Sun Mar 10, 2013 5:30 pm
by cvirus
Thanks for the explanation.  :)