Zohar Posted January 15, 2010 Share Posted January 15, 2010 (edited) Hello I need to Zoom In on a part of the screen, and I need the displayed part not to be a new Window, so it will not take focus from current window. What would be the shortest way to get that? Thank you Edited August 14, 2021 by Zohar Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2010 Moderators Share Posted January 15, 2010 Zohar, This magnifies the area around the cursor. I am sure you can modify it to your needs: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> Opt("GUICloseOnESC", 0) HotKeySet("{ESC}", "On_Exit") Global $hMag_GUI, $hMagDC, $hDeskDC, $hPen, $oObj, $aMouse_Pos[2], $iLast_Mouse_X = 0, $iLast_Mouse_Y = 0 ; Create GUI $hMag_Win = GUICreate("MAG", 100, 100, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hMag_Win) $hMag_GUI = WinGetHandle("MAG") ; 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 ; Create pen $hPen = _WinAPI_CreatePen($PS_SOLID, 5, 0x7E7E7E) $oObj = _WinAPI_SelectObject($hMagDC, $hPen) While 1 ; Check if cursor has moved $aMouse_Pos = MouseGetPos() If $aMouse_Pos[0] <> $iLast_Mouse_X Or $aMouse_Pos[1] <> $iLast_Mouse_Y Then ; Redraw Mag GUI Loupe($aMouse_Pos) ; Reset position $iLast_Mouse_X = $aMouse_Pos[0] $iLast_Mouse_Y = $aMouse_Pos[1] EndIf WEnd Func On_Exit() ; Clear up Mag GUI _WinAPI_SelectObject($hMagDC, $oObj) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDeskDC) _WinAPI_ReleaseDC($hMag_GUI, $hMagDC) GUIDelete($hMag_GUI) Exit EndFunc ;==>On_Exit Func Loupe($aMouse_Pos) Local $iX, $iY ; Fill Mag GUI with 5x expanded contents of desktop area (10 pixels around mouse) DllCall("gdi32.dll", "int", "StretchBlt", _ "int", $hMagDC, "int", 0, "int", 0, "int", 100, "int", 100, _ "int", $hDeskDC, "int", $aMouse_Pos[0] - 10, "int", $aMouse_Pos[1] - 10, "int", 20, "int", 20, _ "long", $SRCCOPY) ; Keep Mag GUI on screen If $aMouse_Pos[0] < (@DesktopWidth - 120) Then $iX = $aMouse_Pos[0] + 20 Else $iX = $aMouse_Pos[0] - 120 EndIf If $aMouse_Pos[1] < (@DesktopHeight - 150) Then $iY = $aMouse_Pos[1] + 20 Else $iY = $aMouse_Pos[1] - 120 EndIf WinMove($hMag_GUI, "", $iX, $iY, 100, 100) EndFunc ;==>Loupe M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Yashied Posted January 15, 2010 Share Posted January 15, 2010 Or this. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Zohar Posted January 20, 2010 Author Share Posted January 20, 2010 Melba23 and Yashied: Thank you very much Link to comment Share on other sites More sharing options...
NassauSky Posted December 3, 2019 Share Posted December 3, 2019 9 Year old post. @Yashied I tried that code you provided but it looks like the UDF doesn't include at least these 2 functions anymore (_WinAPI_FreeObject) & (_WinAPI_FitToBitmap) If you're still around, how may I correct the unknown function errors that show up? Thanks 🙂 Link to comment Share on other sites More sharing options...
Musashi Posted December 3, 2019 Share Posted December 3, 2019 (edited) 1 hour ago, nassausky said: 9 Year old post. Yes, there's already a lot of dust on it . 1 hour ago, nassausky said: @Yashied : If you're still around... Yashied has not been active for a long time (unfortunately). Why don't you use the variant of @Melba23 (see above) ? This script still works ! By the way: It is generally not a good idea to resurrect an old topic from the dead. Many things have changed over the years. I recommend to start a new thread, then you will get up-to-date informations. Edited December 3, 2019 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." 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