Monitoring a part of the screen
Monitoring a part of the screen
I don't know if this is the right platform to post this question, but anyway.
The specific coordinates of the screen will be entered.
Is there a way to monitor what happens in that part of the screen and send the real time output to some other application ? (I am sorry for being vague but at this point I haven't figured out which application. If anyone knows such a program please let me know.)
Regards.
The specific coordinates of the screen will be entered.
Is there a way to monitor what happens in that part of the screen and send the real time output to some other application ? (I am sorry for being vague but at this point I haven't figured out which application. If anyone knows such a program please let me know.)
Regards.
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
What do you mean by "output"?
Re: Monitoring a part of the screen
Say for instance there is a video playing in the selected area
That is the output which is to be rerouted
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Do you mean to show this video in another window on the same desktop?
Re: Monitoring a part of the screen
Yes
Basically I want the video from zoom meeting displayed in another window
(as stated earlier , I am not aware of such a program, so I am taking it one step at a time)
Basically I want the video from zoom meeting displayed in another window
(as stated earlier , I am not aware of such a program, so I am taking it one step at a time)
Re: Monitoring a part of the screen
If you just want to monitor it but not necessarily see smooth video, you can capture an image of that area and display a thumbnail or full-size image of it. You could update it continuously as some rate, but it wouldn't be full video speed.
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Try to run this code, activate the Zoom window, and press F1.
Code: Select all
DWM_TNP_RECTDESTINATION := 0x00000001
DWM_TNP_SOURCECLIENTAREAONLY := 0x00000010
X := 0, Y := 0, W := 400, H := 250
Gui, New, +HwndhGui +AlwaysOnTop +Owner -DpiScale
hLib := DllCall("LoadLibrary", "Str", "Dwmapi.dll", "Ptr")
Return
$F1::
if hThumb
DllCall("dwmapi\DwmUnregisterThumbnail", "Ptr", hThumb)
DllCall("dwmapi\DwmRegisterThumbnail", "Ptr", hGui, "Ptr", WinExist("A"), "PtrP", hThumb)
Gui, %hGui%: Show, x%X% y%Y% w%W% h%H%
VarSetCapacity(DWM_THUMBNAIL_PROPERTIES, 48, 0)
NumPut(DWM_TNP_RECTDESTINATION|DWM_TNP_SOURCECLIENTAREAONLY, DWM_THUMBNAIL_PROPERTIES)
NumPut(W, DWM_THUMBNAIL_PROPERTIES, 12)
NumPut(H, DWM_THUMBNAIL_PROPERTIES, 16)
NumPut(true, DWM_THUMBNAIL_PROPERTIES, 44, "UInt")
DllCall("dwmapi\DwmUpdateThumbnailProperties", "Ptr", hThumb, "Ptr", &DWM_THUMBNAIL_PROPERTIES)
Return
GuiClose:
DllCall("dwmapi\DwmUnregisterThumbnail", "Ptr", hThumb)
DllCall("FreeLibrary", "Ptr", hLib)
ExitApp
Re: Monitoring a part of the screen
You are not right.If you just want to monitor it but not necessarily see smooth video, you can capture an image of that area and display a thumbnail or full-size image of it. You could update it continuously as some rate, but it wouldn't be full video speed.
There are different apis that allow You to do it.
Re: Monitoring a part of the screen
I am right that that I can help him do what I described using screen capture techniques. I didn't say it's not possible to capture video. I said by continuously capturing screen shots, it would not be video quality. But I understand that you would rather tell people that they are wrong than have any kind of nuance in your posts. If you have techniques to help him capture video, then it would probably be better for you to tell OP how to do it rather than just tell people what they are doing is not right.
Re: Monitoring a part of the screen
@teadrinker
WOW !
Pretty Amazing !
This is fantastic
I am sorry for asking you more questions. I usually try to tinker with the code myself, but this seems to be beyond my comprehension
How to get 2 guis that display the feed from each of the participants ?
One gui for displaying my feed
And another for the feed of the person that I am having the meeting with
I.e the gui should take the video from a part of the screen and display it
WOW !
Pretty Amazing !
This is fantastic
I am sorry for asking you more questions. I usually try to tinker with the code myself, but this seems to be beyond my comprehension
How to get 2 guis that display the feed from each of the participants ?
One gui for displaying my feed
And another for the feed of the person that I am having the meeting with
I.e the gui should take the video from a part of the screen and display it
Re: Monitoring a part of the screen
boiler, for example capturing with this api You can get +- 60 fps (as I remember)
https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_2/nn-dxgi1_2-idxgioutputduplication
But topic starter does not need capturing, therefore the best variants I think with thumbnail api or magnifier api.
https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_2/nn-dxgi1_2-idxgioutputduplication
But topic starter does not need capturing, therefore the best variants I think with thumbnail api or magnifier api.
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
I have no Zoom to test, but I think you need something like this:
Code: Select all
Gui, New, hwndhThumb1 -DpiScale +AlwaysOnTop +Owner, First Area
Gui, Show, x0 y0 w300 h300
Gui, New, hwndhThumb2 -DpiScale +AlwaysOnTop +Owner, Second Area
Gui, Show, x0 y350 w300 h300
source1_X := 0, source1_Y := 0, source1_W := 300, source1_H := 300 ; first area in the source window
source2_X := 300, source2_Y := 0, source2_W := 300, source2_H := 300 ; second area in the source window
Return
F1::
Loop 2 {
i := A_Index
Thumb%i% := new ThumbnailGui(hThumb%i%, 300, 300, WinExist("A"), source%i%_X, source%i%_Y, source%i%_W, source%i%_H, true)
}
Return
class ThumbnailGui
{
__New(hWndThumb, thumbW, thumbH, hWndSource, sourceX, sourceY, sourceW, sourceH, clientOnly := false) {
this.hLib := DllCall("LoadLibrary", "Str", "dwmapi.dll")
if DllCall("dwmapi\DwmRegisterThumbnail", "Ptr", hWndThumb, "Ptr", hWndSource, "PtrP", hThumbnailId) != 0
throw "DwmRegisterThumbnail failed"
this.ThumbnailId := hThumbnailId
this.SetSourceRegion(sourceX, sourceY, sourceW, sourceH, clientOnly)
this.SetThumbRegion(thumbW, thumbH)
}
__Delete() {
DllCall("dwmapi\DwmUnregisterThumbnail", "Ptr", this.ThumbnailId)
DllCall("FreeLibrary", "Ptr", this.hLib)
}
SetSourceRegion(X, Y, W, H, clientOnly) {
this.SetRegion(DWM_TNP_RECTSOURCE := 0x2, X, Y, W, H, clientOnly)
}
SetThumbRegion(W, H) {
this.SetRegion(DWM_TNP_RECTDESTINATION := 0x1, 0, 0, W, H)
}
SetRegion(flag, X, Y, W, H, clientOnly := false) {
static DWM_TNP_SOURCECLIENTAREAONLY := 0x10
, DWM_TNP_RECTDESTINATION := 0x1
, DWM_TNP_RECTSOURCE := 0x2
VarSetCapacity(DWM_THUMBNAIL_PROPERTIES, 48, 0)
flags := flag | DWM_TNP_SOURCECLIENTAREAONLY*(flag = DWM_TNP_RECTSOURCE)
NumPut( flags , DWM_THUMBNAIL_PROPERTIES)
NumPut( X , DWM_THUMBNAIL_PROPERTIES, 4 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( Y , DWM_THUMBNAIL_PROPERTIES, 8 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( W + X , DWM_THUMBNAIL_PROPERTIES, 12 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( H + Y , DWM_THUMBNAIL_PROPERTIES, 16 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( clientOnly, DWM_THUMBNAIL_PROPERTIES, 44, "UInt")
this.UpdateThumbnailProperties(&DWM_THUMBNAIL_PROPERTIES)
}
UpdateThumbnailProperties(pProp) {
DllCall("dwmapi\DwmUpdateThumbnailProperties", "Ptr", this.ThumbnailId, "Ptr", pProp)
}
}
Last edited by teadrinker on 03 Sep 2021, 10:01, edited 2 times in total.
Re: Monitoring a part of the screen
in the 5th and the 6th lines
how to enter the coordinates of a rectangle ?
I tried using x value for the top left and Y value for the bottom right
didn't work though
it is currently showing two blank gui windows
how to enter the coordinates of a rectangle ?
I tried using x value for the top left and Y value for the bottom right
didn't work though
it is currently showing two blank gui windows
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
source1_X — left, relative to the client area of the source window
source1_Y — top, relative to the client area of the source window
source1_W — width
source1_H — height
source1_Y — top, relative to the client area of the source window
source1_W — width
source1_H — height
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Some bugs fixed:
Code: Select all
Gui, New, hwndhThumb1 -DpiScale +AlwaysOnTop +Owner, First Area
Gui, Show, x0 y0 w300 h300
Gui, New, hwndhThumb2 -DpiScale +AlwaysOnTop +Owner, Second Area
Gui, Show, x0 y350 w300 h300
source1_X := 0, source1_Y := 0, source1_W := 300, source1_H := 300 ; first area in the source window
source2_X := 300, source2_Y := 0, source2_W := 300, source2_H := 300 ; second area in the source window
Return
F1::
Loop 2 {
i := A_Index
Thumb%i% := new ThumbnailGui(hThumb%i%, 300, 300, WinExist("A"), source%i%_X, source%i%_Y, source%i%_W, source%i%_H, true)
}
Return
class ThumbnailGui
{
__New(hWndThumb, thumbW, thumbH, hWndSource, sourceX, sourceY, sourceW, sourceH, clientOnly := false) {
this.hLib := DllCall("LoadLibrary", "Str", "dwmapi.dll")
if DllCall("dwmapi\DwmRegisterThumbnail", "Ptr", hWndThumb, "Ptr", hWndSource, "PtrP", hThumbnailId) != 0
throw "DwmRegisterThumbnail failed"
this.ThumbnailId := hThumbnailId
this.SetSourceRegion(sourceX, sourceY, sourceW, sourceH, clientOnly)
this.SetThumbRegion(thumbW, thumbH)
}
__Delete() {
DllCall("dwmapi\DwmUnregisterThumbnail", "Ptr", this.ThumbnailId)
DllCall("FreeLibrary", "Ptr", this.hLib)
}
SetSourceRegion(X, Y, W, H, clientOnly) {
this.SetRegion(DWM_TNP_RECTSOURCE := 0x2, X, Y, W, H, clientOnly)
}
SetThumbRegion(W, H) {
this.SetRegion(DWM_TNP_RECTDESTINATION := 0x1, 0, 0, W, H)
}
SetRegion(flag, X, Y, W, H, clientOnly := false) {
static DWM_TNP_SOURCECLIENTAREAONLY := 0x10
, DWM_TNP_RECTDESTINATION := 0x1
, DWM_TNP_RECTSOURCE := 0x2
VarSetCapacity(DWM_THUMBNAIL_PROPERTIES, 48, 0)
flags := flag | DWM_TNP_SOURCECLIENTAREAONLY*(flag = DWM_TNP_RECTSOURCE)
NumPut( flags , DWM_THUMBNAIL_PROPERTIES)
NumPut( X , DWM_THUMBNAIL_PROPERTIES, 4 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( Y , DWM_THUMBNAIL_PROPERTIES, 8 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( X + W , DWM_THUMBNAIL_PROPERTIES, 12 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( Y + H , DWM_THUMBNAIL_PROPERTIES, 16 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( clientOnly, DWM_THUMBNAIL_PROPERTIES, 44, "UInt")
this.UpdateThumbnailProperties(&DWM_THUMBNAIL_PROPERTIES)
}
UpdateThumbnailProperties(pProp) {
DllCall("dwmapi\DwmUpdateThumbnailProperties", "Ptr", this.ThumbnailId, "Ptr", pProp)
}
}
Re: Monitoring a part of the screen
The bottom Left coordinates are : x26 y804teadrinker wrote: ↑03 Sep 2021, 09:44source1_X — left, relative to the client area of the source window
source1_Y — top, relative to the client area of the source window
source1_W — width
source1_H — height
The top Right coordinates are : x966 y275
So is it something like this ?
Code: Select all
source1_X := 26, source1_Y := 275 source1_W := 300, source1_H := 300 ; first area in the source window
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Code: Select all
; The bottom Left coordinates are : x26 y804
; The top Right coordinates are : x966 y275
source1_X := 26
source1_Y := 275
source1_W := 966 - 26 ; 940
source1_H := 804 - 275 ; 529
Re: Monitoring a part of the screen
It is working
I have Changed the gui size to
I tried altering the w&h of source 1 & 2
But I am not able to get it to fill the newly sized gui
the gui has been resized, the video feed inside remains the same
I have Changed the gui size to
Code: Select all
Gui, Show, x0 y350 w600 h400
But I am not able to get it to fill the newly sized gui
the gui has been resized, the video feed inside remains the same
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Show your code in full.
Re: Monitoring a part of the screen
Code: Select all
Gui, New, hwndhThumb1 -DpiScale +AlwaysOnTop +Owner, First Area
Gui, Show, x0 y0 w600 h600
Gui, New, hwndhThumb2 -DpiScale +AlwaysOnTop +Owner, Second Area
Gui, Show, x0 y350 w600 h600
source1_X := 20, source1_Y := 275, source1_W := 300, source1_H := 300 ; first area in the source window
source2_X := 971, source2_Y := 275, source2_W := 300, source2_H := 300 ; second area in the source window
Return
F1::
Loop 2 {
i := A_Index
Thumb%i% := new ThumbnailGui(hThumb%i%, 300, 300, WinExist("A"), source%i%_X, source%i%_Y, source%i%_W, source%i%_H, true)
}
Return
class ThumbnailGui
{
__New(hWndThumb, thumbW, thumbH, hWndSource, sourceX, sourceY, sourceW, sourceH, clientOnly := false) {
this.hLib := DllCall("LoadLibrary", "Str", "dwmapi.dll")
if DllCall("dwmapi\DwmRegisterThumbnail", "Ptr", hWndThumb, "Ptr", hWndSource, "PtrP", hThumbnailId) != 0
throw "DwmRegisterThumbnail failed"
this.ThumbnailId := hThumbnailId
this.SetSourceRegion(sourceX, sourceY, sourceW, sourceH, clientOnly)
this.SetThumbRegion(thumbW, thumbH)
}
__Delete() {
DllCall("dwmapi\DwmUnregisterThumbnail", "Ptr", this.ThumbnailId)
DllCall("FreeLibrary", "Ptr", this.hLib)
}
SetSourceRegion(X, Y, W, H, clientOnly) {
this.SetRegion(DWM_TNP_RECTSOURCE := 0x2, X, Y, W, H, clientOnly)
}
SetThumbRegion(W, H) {
this.SetRegion(DWM_TNP_RECTDESTINATION := 0x1, 0, 0, W, H)
}
SetRegion(flag, X, Y, W, H, clientOnly := false) {
static DWM_TNP_SOURCECLIENTAREAONLY := 0x10
, DWM_TNP_RECTDESTINATION := 0x1
, DWM_TNP_RECTSOURCE := 0x2
VarSetCapacity(DWM_THUMBNAIL_PROPERTIES, 48, 0)
flags := flag | DWM_TNP_SOURCECLIENTAREAONLY*(flag = DWM_TNP_RECTSOURCE)
NumPut( flags , DWM_THUMBNAIL_PROPERTIES)
NumPut( X , DWM_THUMBNAIL_PROPERTIES, 4 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( Y , DWM_THUMBNAIL_PROPERTIES, 8 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( W + X , DWM_THUMBNAIL_PROPERTIES, 12 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( H + Y , DWM_THUMBNAIL_PROPERTIES, 16 + 16*(flag = DWM_TNP_RECTSOURCE) )
NumPut( clientOnly, DWM_THUMBNAIL_PROPERTIES, 44, "UInt")
this.UpdateThumbnailProperties(&DWM_THUMBNAIL_PROPERTIES)
}
UpdateThumbnailProperties(pProp) {
DllCall("dwmapi\DwmUpdateThumbnailProperties", "Ptr", this.ThumbnailId, "Ptr", pProp)
}
}