Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

getpixel tears the screen

I am trying to use the getPixel API to to get the color value of a pixel on the active screen. The code works fine for several minutes and then the screen goes all screwy and the program crashes. I have searched the net for any known problems with the getpixel API, but have not found any reference to the API crashing the program. If I copy the screen to a picture box, I don't have the problem, but it takes quite a long time to bitblt a screen to a picture box, more time than my program can stand.

Does anyone know of this problem using getpixel? Is there a fix for it?

Is there any way to sync the getpixel call with the screen refresh rate?

thanks,
**** Roose
[708 byte] By [droose] at [2007-11-11 7:18:56]
# 1 Re: getpixel tears the screen
I have not heard of any problem with the GetPixel API. Can you post your declaration for the function and an example of how you're calling it?
Phil Weber at 2007-11-11 17:27:10 >
# 2 Re: getpixel tears the screen
Use BitBlt instead of GetPixel
Marco
mstraf at 2007-11-11 17:28:10 >