JohnOne Posted November 27, 2012 Share Posted November 27, 2012 I have cause to use a screen magnifier, and remembered I'd seen and tried one by Melba32 a while back. After a bit of a search I found it But it does not seem to work anymore (it does not follow the mouse (at least on my machine)Anyone have the time to test it?Just want to confirm a problem with my endwin 7 32, AutoIt 3.3.8.0 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
water Posted November 27, 2012 Share Posted November 27, 2012 It doesn't work here too. Windows 7 64 bit, tested with AutoIt 3.3.8.1 and 3.3.9.4. I have two displays and the script seems to create a "window" in the upper left portion of display 1. But it doesn't follow the mouse. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted November 27, 2012 Author Share Posted November 27, 2012 Cheers, Same here. Must need a bit of a tweak. Changed the while loop. While 1 Sleep(10) $MousePos = MouseGetPos() ; Show the correct area Switch $iShow Case 1 Magnify($MousePos) MouseCheck($MousePos) Case 2 Magnify($aCoords_2) MouseCheck($aCoords_2) EndSwitch WEnd To get started but need s bit more messing with. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted November 27, 2012 Author Share Posted November 27, 2012 (edited) I've modified the script a little, to emulate my partial desired effect. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUICloseOnESC", 0) HotKeySet("{ESC}", "On_Exit") HotKeySet("{PAUSE}", "On_Switch") ; to switch areas to be magnified ; Set coordinates for areas to magnify Global $aCoords_1[2] = [750, 500], $aCoords_2[2] = [1000, 500] ; Set size of magnifier GUI Global $iWidth = 200, $iHeight = 200 Global $hMag_Win, $hMagDC, $hDeskDC, $hPen, $oObj, $iShow = 1 ; Create mouse GUI $hMouse_GUI = GUICreate("Mouse", 5, 5, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0, $hMouse_GUI) GUISetState(@SW_SHOW) ; Create Magnifier GUI $hMag_GUI = GUICreate("Test", $iWidth, $iHeight, @DesktopWidth - $iWidth - 10, 10, $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW) ; Get device context for Mag GUI $hMagDC = _WinAPI_GetDC($hMag_GUI) If @error Then Exit ; Get device context for desktop $hDeskDC = _WinAPI_GetDC(0) If @error Then _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) Exit EndIf While 1 Sleep(10) $MousePos = MouseGetPos() ; Show the correct area Switch $iShow Case 1 Magnify($MousePos) MouseCheck($MousePos) Case 2 Magnify($aCoords_2) MouseCheck($aCoords_2) EndSwitch WEnd ; Move the mouse GUI to follow the real mouse Func MouseCheck($aCoords) Local $aMousePos = MouseGetPos() If $aMousePos[0] > $aCoords[0] And $aMousePos[0] < $aCoords[0] And _ $aMousePos[1] > $aCoords[1] And $aMousePos[1] < $aCoords[1] Then Local $iX = $aMousePos[0] + 50;- $aCoords[0]) * 2 Local $iY = $aMousePos[1] + 50;- $aCoords[1]) * 2 WinMove($hMag_GUI, "", $iX, $iY) Else ; Hide mouse GUI if not required WinMove($hMouse_GUI, "", -20, -20) EndIf EndFunc Func On_Exit() ; Clear up _WinAPI_ReleaseDC(0, $hDeskDC) _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) Exit EndFunc ;==>On_Exit Func On_Switch() Switch $iShow Case 1 $iShow = 2 Case 2 $iShow = 1 EndSwitch EndFunc Func Magnify($aCoords) ; Fill Mag GUI with 2x expanded contents of desktop area as set in $aCoords DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, _ "int", $hDeskDC, "int", $aCoords[0] - 100, "int", $aCoords[1] - 100 , "int", $iWidth , "int", $iWidth , _ "long", $SRCCOPY) EndFunc ;==>Magnify Hope M23 does not mind. Now the magnify window centre is the mouse position (not important for that window to follow mouse really) Nor is the mouse Gui. What I'm after now id for the magnification to include everything on the screen, including the mouse. I'm a GDi noob, and I'm still looking but if anyone has an answer I'd love to see it. EDIT: No solution as yet, but need to clarify what I need after looking in screencapture udf to see how it does and does not capture the mouse. It seems to be about _WinAPI_CopyIcon, _WinAPI_GetIconInfo and _WinAPI_DrawIcon which is not what I need. I am drawing lines on the screen (_GDIPlus_PenCreate and _GDIPlus_GraphicsDrawRect) and it's these lines and the mouse I need to see in magnified window, so everything on the screen really. EDIT2: Seems that the cursor in the likes of notepad and scite are magnified but not the mouse, I'm wondering id the mouse is outside of the desktop device context. EDIT3: Tried using _WinAPI_GetDCEx, with flag set to $DCX_LOCKWINDOWUPDATE (0x00000400) "Allows drawing even if there is a LockWindowUpdate call in effect that would otherwise exclude this window. Used for drawing during tracking" No luck. Funilly enough, I can see area selection tools in the magnify window using paint or drawing a rectangle in paint. Edited November 27, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 27, 2012 Share Posted November 27, 2012 Have you tried the built-in magnifier in Win7? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
JohnOne Posted November 27, 2012 Author Share Posted November 27, 2012 (edited) I had not, thanks for the tip, but unfortunately it's a bit crap. I'm looking for pixel perfect, but windows magnifier seems to be like some old fuzzy jpeg picture. Although it does show the mouse and drawn lines. Edited November 27, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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