I encounterd alot of this behavior while creating screenreading tools on some maschine configurations.
I recommend for healthbar reading the proper memtable and checking for the places in the client of your game. If that is over your abilities, you need your application to work in window-mode or you need to hook into its DX-calls (which should be over your abilities then aswell).
If you still get the black-problem in windowed mode your maschine might use SLI or XFire which result in a 'flickering' while reading from videomem. In that case you could write your own checkpixel like i finaly did that gets your proper results. Or you just modify the existing one like this
Func checkpixel(Const $xpos, Const $ypos)
$cptimer = TimerInit()
Local $color1 = 0, $i = 0
While $color1 = 0 And $i < 3
$color1 = PixelGetColor($xpos, $ypos)
If $color1 = 0 Then Sleep(1)
$i += 1
WEnd
;~ ConsoleWrite('Color = '&$color1& ' ,Trys = '&$i&@CRLF)
Return $color1
EndFunc ;==>checkpixel
This will kill your overall performance but from what i get just reading a bar or checking on a button this will do.
If you are about to get into 'real' bot-coding your problems will be far more advanced, so will your skill.