PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → How to identify an active monitor
How to identify an active monitor
Iniciado por PADSOFT, out., 08 2020 2:57 PM - 1 resposta
Membro registado
5 mensagems
Publicado em outubro, 08 2020 - 2:57 PM
Hi,
I am trying to put a double mouseclick with SendKey("{LEFTBTN2,180,640,}") on a specific place on the screen of an external window.
But depending of the used monitor and screen resolution, this fixed place can be somewhere else on the screen.
I can identify the two monitors using "Syslistscreen". I can also split them into two variables, so I have also the resolution ("SysscreenResolution") of both monitors.
But I do not know on which monitor the active window is, so I cannot calculate the correct position I need to the different resolutions.
This is the part of my test code:

PROCEDURE test()
sVideo, sCreen is string
Y_res, X_res, Pixel is int
ResString, sCreen1, sCreen2 is string
GsScherm=EDT_Wings_screen
ResHandle = SysWinHandle(GsScherm)
nResFocus = SysSetFocus(ResHandle)
IF ResHandle = Null THEN
Info("Window not found")
ReturnToCapture(EDT_Wings_screen)
ELSE
sCreen=SysListScreen()
sCreen1=ExtractString(sCreen,1,CR)
sCreen2=ExtractString(sCreen,2,CR)
ResString = SysScreenResolution(sCreen2) //sCreen2 must be repaced by the active screen which I cannot identify.
IF ResString="" THEN
info(ErrorInfo())
ReturnToCapture(EDT_Wings_screen)
END
X_res = ExtractString(ResString, 1) // This information will be used to calculate the correct position on the screen
Y_res = ExtractString(ResString, 2)
Pixel = ExtractString(ResString, 3)
Multitask(10)
SendKey("{LEFTBTN2,180,640,}") //This is the correct position for screen 1, but not for screen two, with a different resolution.

--
Peter Adema
WINDEV programmer since 2012
Publicado em abril, 30 2022 - 8:10 PM
I used this to move a window to a second screen and maximize it

sScreens is string = SysListScreen()

sScreen1 is string = ExtractString(sScreens,1,CR)
sScreen2 is string = ExtractString(sScreens,2,CR)

IF sScreen2 = "" THEN RETURN

sRes1 is string = SysScreenResolution(sScren1)
iScreen1PosX is int = ExtractString(sRes1,1,TAB)

WIN_Image.X = WIN_Image.X + iScreen1PosX
WIN_Image.Maximize()