Jump to content

_WinAPI_GetPixel on a Parent Window


Recommended Posts

Hey guys. I am looking for a solution for many days, but couldn't find something that helps.
(Posted the same question on Discord already and now trying to reach some more people here :))
 

I'm using the Webview2 UDF to create an embedded browser into my GUI. What i want do to now is, to detect some event depening on pixels(sadly pixels is the only way). Then my script would start a timer to show me how long the event lasts.(Basically want it to run 24/7 so it monitors permanently).

This is how i quickly tested it:

$handle = WinGetHandle("WebView2 Sample")
    $hdc = _WinAPI_GetDC ( $handle )
    $pix=_WinAPI_GetPixel($hdc, 400 , 400)
    ;Need to do it via device context, otherwise my browser cannot be in background(not minimized, just behind other windows so i can keep using my pc)
    MsgBox(4096,"",Hex($pix,6))

While this doesn't work for WebView2, because it always gives me the same Pixelcolor over and over again for an empty window, it does work for FireFox.(Bot not for Chrome, lol)
Alright, so i tho i am smart and simply added Firefox as a parent to my GUI using: _WinAPI_SetParent.
However _WinAPI_GetPixel stops working if used on a Parent Window.
And this is where the actual problem is. For some reason it cannot find any Pixel on a Parent. Even _WinAPI_PrintWindow returns a pure black image if used on parents.



Anyone got an idea why this is happening or if i'm actually missing something?
I could stick to Firefox itself without embedding it into my GUI, however my goal is to get this working like described above...

 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...