Micha, you were right, there was a strange bug I didn't care to fully understand. Anyway, I wanted to use a trick given by Laszlo, giving a simplier code, giving correct results.
I updated the code above. Thanks for pointing that out.
Mmm, I even updated the code to show in parallel the results of the DllCall and those of PixelGetColor.
If anyone else has noticed unreliability with PixelGetColor in normal windows (not games or transparent windows), please let me know.
I already pointed out a problem with SciTE, where all results are "CLR_INVALID" or 0xFFFFFF.
With my new version, I tested in Win98SE, with an offset to be sure of no interference with the cursor (although you mention it should make no difference outside games).
The results are very strange...
For example, over the AutoHotkey Help window, the results are consistent when the window is active, but when it becomes inactive, PixelGetColor (PGC) gives seemingly random results, mostly 0xFFFFFF.
Starting Wordpad, over the title bar, the result of PGC varies depending where the bar is...
Sometime, both results are stuck on 0xFFFFFF, then restart of behave correctly.
I can't test on WinXP right now, but I will update this post when I will get the opportunity.
Please, try and test my little snippet, to see if there is a problem only on my systems/applications/themes/color schemes/whatever.