ssamko

Move pic object

8 posts in this topic

#1 ·  Posted (edited)

Hello ! 

I have a small problem with taking screen. What I do:

1) I take a screenshot of window(thanks to it's hwnd)

2) I save this picture on desktop

but that saved picture is moved +8px from left and top

is there any GDI function which can move this graphic object immediately after screen-shot on position 0,0 (it means it have to move it -8px top and -8px left)

 

I hope you understand

I would be very thankful for help !

Thnx !

Edited by ssamko

Share this post


Link to post
Share on other sites



There are so many screenshot UDFs available on the forum - which one do you use?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

1 hour ago, water said:

There are so many screenshot UDFs available on the forum - which one do you use?

This one ....can you tell me write why this happens ? 

 

 

Edited by ssamko

Share this post


Link to post
Share on other sites

Why don't you use function _ScreenCapture_CaptureWnd that comes with AutoIt?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I have my reasons....for me this one is better for my purposes....but probably you dont know why it happens right ? 

Share this post


Link to post
Share on other sites

Right.
I just wanted to ask the right questions to get more information about your problem.
There are many users how know much more about GDI. Hopefully one of them chimes in.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Try once the _ScreenCapture_CaptureWnd instead and you see if the problem is from your used UDF. When it is from you can switch to original, if not show the code you used to save image as desktopimage.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I think this is what you're trying to do, shift the captured image to the left 8px and up 8px

#include <GDIplus.au3>
#include <ScreenCapture.au3>
#include <WinApi.au3>

Opt("WinTitleMatchMode", -2)

Global $xOffset = -8
Global $yOffset = -8

_GDIPlus_Startup()
Example()

Func Example()
    Local $hBitmap = _ScreenCapture_CaptureWnd("", WinGetHandle("VLC media player"))
    Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
    Local $hBitmap2 = _GDIPlus_BitmapCreateFromScan0(_GDIPlus_ImageGetWidth($hImage) + $xOffset, _GDIPlus_ImageGetHeight($hImage) + $yOffset)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap2)

    _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, $xOffset, $yOffset)
    _GDIPlus_ImageSaveToFile($hBitmap2, @DesktopDir & "\Image.png")

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_ImageDispose($hBitmap2)
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_Shutdown()
EndFunc

 

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

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