How to magnify an area in the middle?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ComeOrDream
Posts: 1
Joined: 04 May 2024, 18:19

How to magnify an area in the middle?

04 May 2024, 23:15

Code: Select all

OnExit handle_exit
  Gui,  +Owner +Resize +ToolWindow
  WinGet, PrintSourceID, id
  hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
  hdb_frame := DllCall( "GetDC", UInt, active_id )
  hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
  Gosub, Repaint
return


Repaint:
	zoom := 2
	Antialize := 1
	delay := 8
        start_x := 1280
	start_y := 720
	ww = 500
	wh = 400
        DllCall("gdi32.dll\StretchBlt", UInt,hdb_frame,Int,start_x - ww / 2 , Int,start_y - wh / 2
		,Int,ww, Int,wh
		,UInt,hdb_frame
		,Int,start_x-(ww / 2 / zoom), Int,start_y - (wh/2/zoom)
		,Int,ww / zoom, Int,wh / zoom
		,UInt,0xCC0020) ; SRCCOPY
       SetTimer, Repaint , %delay%
Return

GuiClose:
handle_exit:
   DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
   DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
ExitApp
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]


I want to magnify a central tangle area by 2, and display it in the same area of the screen. But when running this program, the magnify will go to a loop, the middle point will be magnified recursively
Rohwedder
Posts: 7895
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to magnify an area in the middle?

05 May 2024, 04:40

Hallo,
your Timer does not zoom the area under the magnification window but the magnification window itself.
Marcgii had found a solution for the same problem himself using DllCall("user32.dll\SetWindowDisplayAffinity", UInt, hWnd, UInt,0x00000011)
See viewtopic.php?f=76&t=119770&hilit=StretchBlt

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo and 148 guests