JonF Posted October 30 Share Posted October 30 (edited) I'm trying to read a pixel from the screen of a particular program. It always comes out black (0x000000). One should be white, the other should be blue. Is there some aspect of this program that prevents reading a pixel? #include <GetScreen.au3> Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Run("C:\Program Files (x86)\YT Saver\ytsaverw.exe",@TempDir,@SW_MAXIMIZE) Opt("WinTitleMatchMode", 2) _WinWaitActivate("YT Saver","") $Handle = WinGetHandle("YT Saver") Sleep(5000) $aWin = WinGetPos($Handle) $Width = $aWin[2] $Height = $aWin[3] _GetScreen_Initialize($Width, $Height) _GetScreen_GetWindow($Handle) $Color = _GetScreen_GetPixel(350,200) $Color2 = _GetScreen_GetPixel(110,90) WinClose($Handle) $Color=Hex($Color,6) $Color2=Hex($Color2,6) MsgBox(0,"Info",$Color & " " & $Color2 & @CRLF & $Width & " " & $Height) Test.mp4 Edited October 30 by JonF Link to comment Share on other sites More sharing options...
Nine Posted October 30 Author Share Posted October 30 (edited) Yes, like previously discussed in this topic, some windows do not support WM_PRINT or WM_PRINTCLIENT messages. You may try _GetScreen_GetWindow with flag set at 2. But since you are activating the window, I strongly suggest that you use _GetScreen_GetScreen instead. Edited October 30 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JonF Posted October 31 Share Posted October 31 Oooh, GetScreen worked. I don't remember why I chose Get Window. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now