Page 1 of 1
[Solved] GetPixel_
Posted: Sat Aug 27, 2022 10:54 pm
by IdeasVacuum
Is GetPixel_ still supported?
Code from an old (working) program
Code: Select all
GetCursorPos_(@igPt)
igRGB = GetPixel_(ghDC, igPt\x, igPt\y)
... only returns Black

Re: GetPixel_
Posted: Sat Aug 27, 2022 11:18 pm
by chi
Still working...
Code: Select all
ghDC = GetDC_(GetDesktopWindow_())
GetCursorPos_(@igPt.POINT)
igRGB = GetPixel_(ghDC, igPt\x, igPt\y)
Debug Hex(igRGB)
ReleaseDC_(GetDesktopWindow_(), ghDC)
Re: GetPixel_
Posted: Sun Aug 28, 2022 9:29 am
by tft
When you want to grab a pixel from a video, for example Crunchiroll. this won't work. At least if you have W10 and a computer with DRM protection mechanism. The data is then displayed directly on the screen. Not on the desktop anymore.
Code: Select all
ghDC = GetDC_(GetDesktopWindow_())
GetCursorPos_(@igPt.POINT)
igRGB = GetPixel_(ghDC, igPt\x, igPt\y)
ReleaseDC_(GetDesktopWindow_(), ghDC)
this works fine ....
TFT
Re: GetPixel_
Posted: Sun Aug 28, 2022 10:58 am
by IdeasVacuum
Thanks for your help guys
The original code for the desktop handle was:
I changed that to GetDesktopWindow_() , but the result is the same. So I think there is probably a failure earlier in the code - more testing tonight.
Edit: It was indeed a bug elsewhere!
Re: GetPixel_
Posted: Sun Aug 28, 2022 11:31 am
by BarryG
tft wrote: Sun Aug 28, 2022 9:29 amWhen you want to grab a pixel from a video, for example Crunchiroll. this won't work.
Using GetDC_(0) works with CrunchyRoll videos for me - the correct pixel color is returned. Both windowed (in-browser) and full-screen playback.
Using Win 10 Pro. Don't know about any DRM settings in Windows.
Re: GetPixel_
Posted: Mon Aug 29, 2022 12:47 am
by IdeasVacuum
BarryG wrote: Sun Aug 28, 2022 11:31 am
Using GetDC_(0) works with CrunchyRoll videos for me - the correct pixel color is returned. Both windowed (in-browser) and full-screen playback.
Yes, GetDC_(0) covers the entire 'virtual desktop' across however many monitors there are. Works with any pixel grab for me (Now I have fixed the bug that silently messed it up).