GetPixel app

In this category you can exchange your programming questions and solutions.
Post Reply
cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

GetPixel app

Post: # 1050Post cvirus
Sat Mar 09, 2013 5:16 pm

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


Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

GetPixel app

Post: # 1051Post Marco
Sun Mar 10, 2013 4:44 pm

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

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

GetPixel app

Post: # 1052Post cvirus
Sun Mar 10, 2013 5:30 pm

Thanks for the explanation.  :)

Post Reply