Jump to content

Recommended Posts

Posted

I use _ScreenCapture_Capture function for taking a screenshot with cursor located within browser window. But cursor position on the screenshot is misaligned. Its location is shifted about 20px left and 20px up.  What is the reason of this issue?

Posted (edited)

How did you determine what the coordinates for the _ScreenCapture_Capture() should be?  If you used the Au3Info tool, which coordinate mode did you use?  If you are using MouseGetPos(), then make sure that you are using the correct MouseCoodMode option.

Edited by TheXman
Posted
15 hours ago, Nine said:

What is your scaling ?  If it is different than 100%. Try setting browser and windows at 100%, see if it solves it.

Checked once more for the paint window. The result is the same as for the browser

 

screenshot bug.png

Posted
On 7/15/2019 at 5:06 PM, Nine said:

Using your own code with your own picture, you can see that it works perfectly...

I still believe it is a question of scaling.

 

Yes, I agree with you. But the question is why this scaling happens. If I make two screenshots: one with the PrnScn button and another with the script I get different results. Those made with the button is not scaled and script made screenshot is really scaled...

Posted (edited)

This is the code included in the ScreenCapture.au3 UDF about location of cursor :

Local $aCursor = _WinAPI_GetCursorInfo()
        If Not @error And $aCursor[1] Then
            $bCursor = True ; Cursor info was found.
            Local $hIcon = _WinAPI_CopyIcon($aCursor[2])
            Local $aIcon = _WinAPI_GetIconInfo($hIcon)
            If Not @error Then
                _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo()
                If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo()
                _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon)
            EndIf
            _WinAPI_DestroyIcon($hIcon)
        EndIf

If you wish to find where the function is in error, you could modify to check where the info gets defective...

Edited by Nine
Posted
31 minutes ago, Nine said:

This is the code included in the ScreenCapture.au3 UDF about location of cursor :

Local $aCursor = _WinAPI_GetCursorInfo()
        If Not @error And $aCursor[1] Then
            $bCursor = True ; Cursor info was found.
            Local $hIcon = _WinAPI_CopyIcon($aCursor[2])
            Local $aIcon = _WinAPI_GetIconInfo($hIcon)
            If Not @error Then
                _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo()
                If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo()
                _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon)
            EndIf
            _WinAPI_DestroyIcon($hIcon)
        EndIf

If you wish to find where the function is in error, you could modify to check where the info gets defective...

No errors, cursor coordinates remain the same from the beginning until calling draw icon function. So cursor is captured ok, but the screen image underneath the cursor shrinks.

Posted
7 minutes ago, Vitaliy4us said:

So cursor is captured ok, but the screen image underneath the cursor shrinks.

If the image shrinks, should the cursor be located down-right ?  In you case, it is up-left, like if the image expands, no ?   What version of windows and autoit are you using ?

Posted (edited)
14 minutes ago, Nine said:

If the image shrinks, should the cursor be located down-right ?  In you case, it is up-left, like if the image expands, no ?   What version of windows and autoit are you using ?

I use Win10 and the last version of Autoit v. 3.3.14

Edited by Vitaliy4us
Posted
16 minutes ago, Nine said:

Just curious, could you look at this :

Go to the Windows Start Menu.

Choose Settings.

Select System.

Select Display.

Look for Scale and layout.   What is the % ?

125% (recommended). Also I checked image sizes for the both: PrnScn screenshot and Script Screenshot. The results are:

btn - 1920x1080 resolution 120
script - 1536x864 resolution 96

Posted (edited)
9 minutes ago, Nine said:

Could you put 100% instead and try your script again...

Yes, now it looks ok, but too small. Thanks. By the way, it should be the reason why the screenshot made by the script is cropped while captured with the button is ok. 

Edited by Vitaliy4us

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...