shahzaibkhalid2315 Posted August 15, 2023 Share Posted August 15, 2023 Hi Team, I am having issue with _ScreenCapture_CaptureWnd this function as I am taking snap of same coordinates on Window 10 and Window 11 but Snaps are different. Regards: Shahzaib Khalid. Link to comment Share on other sites More sharing options...
ioa747 Posted August 15, 2023 Share Posted August 15, 2023 check your windows scaling size, the problems usually come when you have a scale greater than 100% right click on desktop and select display setting , then Scale and layout I know that I know nothing Link to comment Share on other sites More sharing options...
argumentum Posted August 15, 2023 Share Posted August 15, 2023 (edited) try: #AutoIt3Wrapper_UseX64=n DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) at the beginning of your script and let me know. That may be all you need. For more information go to "Tester needed ^^" Edit: Might as well give you running code: ( ain't working that good ) Spoiler #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_HiDpi=y DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; lazy me. Use something better here ;-) #include <ScreenCapture.au3> Example() Func Example() ; Retrieve the position as well as height and width of the active window. Local $aPos = WinGetPos("[ACTIVE]") ; Display the array values returned by WinGetPos. ConsoleWrite(WinGetTitle("[ACTIVE]") & @CRLF) ConsoleWrite("X-Pos: " & $aPos[0] & " / " & _ "Y-Pos: " & $aPos[1] & " / " & _ "Width: " & $aPos[2] & " / " & _ "Height: " & $aPos[3] & @CRLF) FileDelete(@MyDocumentsDir & "\GDIPlus_Image.jpg") _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", WinGetTitle("[ACTIVE]")) ;~ _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.jpg", $aPos[0], $aPos[1], $aPos[0] + $aPos[2], $aPos[1] + $aPos[3]) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example and the reason is: something is funky on x64 using "_ScreenCapture_Capture()". "_ScreenCapture_CaptureWnd()" is ok. ...it may need a ticket. Edit2: No need for a ticket, just a better example expandcollapse popup#AutoIt3Wrapper_UseX64=y ; no longer matters #AutoIt3Wrapper_Res_HiDpi=n ;~ DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; nope !. Use the UDF from below #include "_WinAPI_DPI.au3" ; https://www.autoitscript.com/forum/topic/210604-tester-needed/?do=findComment&comment=1522028 #include <ScreenCapture.au3> Example() Func Example() ; ..snippet from https://www.autoitscript.com/forum/topic/210604-tester-needed/?do=findComment&comment=1522028 Local $AWARENESS Switch @OSBuild Case 9200 To 13999 $AWARENESS = $DPI_AWARENESS_PER_MONITOR_AWARE Case @OSBuild > 13999 $AWARENESS = $DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 EndSwitch _WinAPI_SetDPIAwareness($AWARENESS, 2) ; Retrieve the position as well as height and width of the active window. Local $aPos = WinGetPos("[ACTIVE]") ; Display the array values returned by WinGetPos. ConsoleWrite(WinGetTitle("[ACTIVE]") & @CRLF) ConsoleWrite("X-Pos: " & $aPos[0] & " / " & _ "Y-Pos: " & $aPos[1] & " / " & _ "Width: " & $aPos[2] & " / " & _ "Height: " & $aPos[3] & @CRLF) FileDelete(@MyDocumentsDir & "\GDIPlus_Image.jpg") ;~ _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", WinGetTitle("[ACTIVE]")) _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.jpg", $aPos[0], $aPos[1], $aPos[0] + $aPos[2], $aPos[1] + $aPos[3]) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example Edited August 15, 2023 by argumentum oops Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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