Monitoring a part of the screen
Re: Monitoring a part of the screen
I recommend that if you haven't read the Structure of a Script section of the documentation, read it and make simple scripts with auto-execute sections and hotkeys until you understand how it works. If you have read it, then review it and practice it with simple test scripts. Also review the #Include page of the documentation and understand exactly what it does.
Re: Monitoring a part of the screen
Thank you boiler
It may take me some time to understand all that.
I will post any updates here
It may take me some time to understand all that.
I will post any updates here
Re: Monitoring a part of the screen
Thanks for the example, I was just looking for this for my script.
But unfortunately your code does not work for me - it shows an error on this line
I don't know what to do to make it work on my windows 7.
The original idea was to take a video from the Sega Zero Tolerance game from emulator window and, after replanning the location of the visible area and the map, bring them to a new window - make the visible part on the whole window, and display the map semi-transparently in the upper right corner. )))
So still don't know how to do it.
But unfortunately your code does not work for me - it shows an error on this line
Code: Select all
throw "DwmRegisterThumbnail failed"
The original idea was to take a video from the Sega Zero Tolerance game from emulator window and, after replanning the location of the visible area and the map, bring them to a new window - make the visible part on the whole window, and display the map semi-transparently in the upper right corner. )))
So still don't know how to do it.
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
On Windows 7 this script will only work if the Aero theme is enabled.
Re: Monitoring a part of the screen
Understandable, thanks. Can you suggest something as simple as this?
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
For Windows 7 no idea.
Re: Monitoring a part of the screen
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/magapi/entry-magapi-sdk
On forum You can find some examples.
On forum You can find some examples.
Re: Monitoring a part of the screen
You need to search for MagSetWindowTransform or MagSetColorEffect.
Some info can get here:
viewtopic.php?f=76&t=94011
Some info can get here:
viewtopic.php?f=76&t=94011
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
@malcev
According to my tests it doesn't work on Windows 7 either without enabling Aero theme.
Tested like this:
According to my tests it doesn't work on Windows 7 either without enabling Aero theme.
Tested like this:
Code: Select all
x := 500
y := 500
w := 320
h := 240
Gui, +HWNDhGui +AlwaysOnTop
Gui, Destroy
hGui := ""
#SingleInstance Force
SetBatchLines -1
SetWinDelay -1
OnExit, Uninitialize
Gui, +HWNDhGui -DPIScale -Caption +AlwaysOnTop +E0x02000000 +E0x00080000 +E0x20 ; WS_EX_COMPOSITED := E0x02000000 WS_EX_LAYERED := E0x00080000
Gui, Margin, 0,0
Gui, Show, x%x% y%y% w%w% h%h% NA
DllCall("LoadLibrary", "str", "magnification.dll")
DllCall("magnification.dll\MagInitialize")
hChildMagnifier := DllCall("CreateWindowEx", "UInt", 0, "Str", "Magnifier", "Str", "MagnifierWindow", "UInt", WS_CHILD := 0x40000000, "Int", 0, "Int", 0, "Int", w, "Int", h, "Ptr", hGui, "UInt", 0, "Ptr", DllCall("GetWindowLong" (A_PtrSize=8 ? "Ptr" : ""), "Ptr", hGui, "Int", GWL_HINSTANCE := -6 , "ptr"), "UInt", 0, "ptr")
Matrix := "-1|0|0|0|0|"
. "0|-1|0|0|0|"
. "0|0|-1|0|0|"
. "0|0|0|1|0|"
. "1|1|1|0|1"
VarSetCapacity(MAGCOLOREFFECT, 100, 0)
Loop, Parse, Matrix, |
NumPut(A_LoopField, MAGCOLOREFFECT, (A_Index - 1) * 4, "Float")
DllCall("magnification.dll\MagSetColorEffect", "Ptr", hChildMagnifier, "Ptr", &MAGCOLOREFFECT)
WinShow, ahk_id %hChildMagnifier%
Loop
{
if (A_PtrSize = 8)
{
VarSetCapacity(RECT, 16, 0)
NumPut(x, RECT, 0, "Int")
NumPut(y, RECT, 4, "Int")
NumPut(w, RECT, 8, "Int")
NumPut(h, RECT, 12, "Int")
DllCall("magnification.dll\MagSetWindowSource", "Ptr", hChildMagnifier, "Ptr", &RECT)
}
else
DllCall("magnification.dll\MagSetWindowSource", "Ptr", hChildMagnifier, "Int", x, "Int", y, "Int", w, "Int", h)
}
Return
Uninitialize:
DllCall("magnification.dll\MagUninitialize")
ExitApp
Re: Monitoring a part of the screen
I dont have win7 now.
But it should work, cause there are no info that You should have aero enabled.
You can try to run and convert this autoit examples:
https://www.autoitscript.com/forum/topic/161193-magnifier-functions-windows-vista-magnifier-manipulation/
But it should work, cause there are no info that You should have aero enabled.
You can try to run and convert this autoit examples:
https://www.autoitscript.com/forum/topic/161193-magnifier-functions-windows-vista-magnifier-manipulation/
; Setting DWM off has these effects:
; - Full-screen Magnifier Color Effects AND Magnification do NOT work
; - Magnifier Control will not 'ignore' windows with _MagnifierSetWindowFilter()
; - Magnified images tend to look blurry - possibly software-mode magnification?
; Force DWM off so Full-screen Effect tests don't run
;_WinAPI_DwmEnableComposition(False)
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
I dont need it too.
I even think that support Win-7 is bad practice.
I thought that You are interested why code does not work on win7 with dwm off and therefore asked it.
I read autoit code and see that to work on win7 with dwm off before MagSetColorEffect We need to call MagSetWindowTransform.
I even think that support Win-7 is bad practice.
I thought that You are interested why code does not work on win7 with dwm off and therefore asked it.
I read autoit code and see that to work on win7 with dwm off before MagSetColorEffect We need to call MagSetWindowTransform.
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Monitoring a part of the screen
Yep, this made it working:
Code: Select all
#SingleInstance Force
SetBatchLines -1
SetWinDelay -1
x := 400
y := 200
w := 400
h := 280
scaleFactor := 1
DllCall("LoadLibrary", "str", "magnification.dll")
DllCall("magnification\MagInitialize")
OnExit("Uninitialize")
Gui, % "+hwndhGui -DPIScale +AlwaysOnTop +E" . (WS_EX_COMPOSITED := 0x02000000) | (WS_EX_LAYERED := 0x00080000)
Gui, Add, Custom, ClassMagnifier hwndhMagnifier x0 y0 w%w% h%h%
Gui, Show, x0 y0 w%w% h%h%
VarSetCapacity(MAGTRANSFORM, 36, 0)
for k, v in [scaleFactor, scaleFactor, 1]
NumPut(v, MAGTRANSFORM, (A_Index - 1) * 16, "Float")
DllCall("magnification\MagSetWindowTransform", "Ptr", hMagnifier, "Ptr", &MAGTRANSFORM)
if (A_PtrSize = 4)
params := ["Int", x, "Int", y, "Int", w, "Int", h]
else {
VarSetCapacity(RECT, 16, 0)
for k, v in [x, y, w, h]
NumPut(v, RECT, (A_Index - 1) * 4, "Int")
params := ["Ptr", &RECT]
}
Loop
DllCall("magnification\MagSetWindowSource", "Ptr", hMagnifier, params*)
Return
GuiClose() {
ExitApp
}
Uninitialize() {
DllCall("magnification\MagUninitialize")
}
But you can set the scale factor by this way on modern OS.
Who is online
Users browsing this forum: Google [Bot] and 104 guests