Sign in to follow this  
Followers 0
ashly

_ScreenCapture_Capture cannot capture the whole screen

6 posts in this topic

i'm trying to use _ScreenCapture_Capture($sFileName) to cature full screen and save as a jpg file, but it always only capture the left-top about 3/4 area.

but the print screen keyboard woks fine.

and if i changed the display resolution from 150% to 100%, the jpg file is OK as well.

so the issue only occurred when resolution is 150%.

is there anybody know why or how to change resolution percentage by scripts?

Thanks.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

@AutoBert thanks for your reply. yes, i had tried with values but it is still the same.

Edited by ashly

Share this post


Link to post
Share on other sites

@RTFC Thank u very much! My problem is solved after seeing the article u mentioned. :D

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
Sign in to follow this  
Followers 0

  • Similar Content

    • junkone
      Ninjatrader scroll to right
      By junkone
      I have a script that takes screenshots of the ninjatrader charting window. I have 2 issues that i need an idea for solution.
      1. i need to scroll the window fully to right? the title of the window =$EURUSD  and the class of the scrollbar =WindowsForms10.SCROLLBAR.app.0.378734a
      i am already having the handle of the window using $hWnd = WinGetHandle($Title5) 
      how can i click the scrollbar all the way to right?Fixed
      2. sometimes the chart scaling is invalid and so there will be a icon F that i have highlighted with arrow on the image. its in the top right hand corder of this window. All i have to do is to click on it to restore the scaling. How can i find that point and automate the click?

      #include <ScreenCapture.au3> Example() Func Example() Local $hWnd Local $Title5 ="$EURUSD" Local $FilePath="c:\temp\images" Local $FileName="Filename" Opt("WinTitleMatchMode", 2) if($CmdLine[0]>0) Then ; Contains the total number of items in the array. $FileName=$CmdLine[1] EndIf If WinExists($Title5) Then ; MsgBox($MB_SYSTEMMODAL, "", $CmdLine[0]) ; Retrieve the handle of the Notepad window using the classname of Notepad. $hWnd = WinGetHandle($Title5) ; Activate the Notepad window using the handle returned by WinWait. WinActivate($hWnd) ;scroll to the right EndFunc ; click on focus icon ; Capture window _ScreenCapture_CaptureWnd( $FilePath & $FileName & $Title5 &".jpg", $hWnd) Else MsgBox($MB_SYSTEMMODAL, "", "Window does not exist") EndIf #CS If WinExists($Title1) Then ### ; MsgBox($MB_SYSTEMMODAL, "", $CmdLine[0]) ### ; Retrieve the handle of the Notepad window using the classname of Notepad. ### $hWnd = WinGetHandle($Title1) ### ; Activate the Notepad window using the handle returned by WinWait. ### WinActivate($hWnd) ### ### ; Capture window ### _ScreenCapture_CaptureWnd( $FilePath & $FileName & $Title1 &".jpg", $hWnd) ### ### Else ### MsgBox($MB_SYSTEMMODAL, "", "Window does not exist") ### EndIf #CE ShellExecute($FilePath & $FileName & $Title5 &".jpg") ShellExecute($FilePath & $FileName & $Title1 &".jpg") EndFunc ;==>Example  
    • SalamanderSoup
      Capture Screenshot using snipping tool
      By SalamanderSoup
      I've created a simple script that opens the Snipping Tool; Selects the "Full Screen Snip" option; then closes the program, prompting a save.  What I can't figure is how to name the file using the system date and time.
      Can anyone help?
      Run(@WindowsDir & '\system32\SnippingTool.exe') AutoItSetOption('MouseCoordMode', 0) Sleep(1) $hWnd= WinWait("Snipping Tool", "ToolBarWindow32", 1) WinActive($hWnd) MouseClick('primary', 84, 48, 1, 0) MouseClick('primary', 84, 140, 1, 0) WinClose("[Class:Microsoft-Windows-Tablet-SnipperEditor]") ControlClick("Snipping Tool", "", "Button1")  
       
       
       
    • rootx
      Title bar icon resolution issue help
      By rootx
      the icon loses resolution, why?
      THX
      #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Global $icon = @ScriptDir&"\res\Wpresize.ico" #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("test", 477, 300, 192, 124) If Not @Compiled Then GUISetIcon($icon) GUISetIcon($icon, -1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
      Wpresize.ico

    • DrAhmed
      [SOLVED] Convert Bitmap image to JPG in memory
      By DrAhmed
      Hey
      I'm not really familliar with GDI Plus , I am looking for how tocConvert a bitmap image to JPG in memory without saving it to disk
      Because I want to send it later via TCP directly without using FileRead and other stuff ..
      The only function I found is below but it saves the image in disk
      Func SaveBmp2JPG($Bitmap, $sSave = "Converted.jpg", $iQuality = 20) ;coded by UEZ 2013 If Not IsPtr($Bitmap) Then $Bitmap = _GDIPlus_ImageLoadFromFile($sFile) If @error Then Return SetError(1, 0, 0) EndIf Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") Local $tParams = _GDIPlus_ParamInit(1) Local $tData = DllStructCreate("int Quality") Local $pData = DllStructGetPtr($tData) Local $pParams = DllStructGetPtr($tParams) DllStructSetData($tData, "Quality", $iQuality) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) If Not _GDIPlus_ImageSaveToFileEx($Bitmap, $sSave, $sCLSID, $pParams) Then Return SetError(2, 0, 0) Return True EndFunc what my code now looks like :
      #include <ScreenCapture.au3> #include <guiconstantsex.au3> #include <gdiplus.au3> #include <memory.au3> #include <staticconstants.au3> Global $ghGDIPDLL = $__g_hGDIPDll Example() Func Example() _GDIPlus_Startup() Local $hHBmp = _ScreenCapture_Capture("") ;create a GDI bitmap by capturing my desktop Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI bitmap to GDI+ bitmap _WinAPI_DeleteObject($hHBmp) ;release GDI bitmap resource because not needed anymore Local $hBitmap_Scaled2 = _GDIPlus_ImageResize($hBitmap, @DesktopWidth / 1.5, @DesktopHeight / 1.5) ;resize image SaveBmp2JPG($hBitmap_Scaled2,'Test.jpg',99) ; ===> Saving to disk ?? _GDIPlus_Shutdown() EndFunc ;==>Example Func SaveBmp2JPG($Bitmap, $sSave , $iQuality) ;coded by UEZ 2013 If Not IsPtr($Bitmap) Then $Bitmap = _GDIPlus_ImageLoadFromFile($sFile) If @error Then Return SetError(1, 0, 0) EndIf Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") Local $tParams = _GDIPlus_ParamInit(1) Local $tData = DllStructCreate("int Quality") Local $pData = DllStructGetPtr($tData) Local $pParams = DllStructGetPtr($tParams) DllStructSetData($tData, "Quality", $iQuality) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) If Not _GDIPlus_ImageSaveToFileEx($Bitmap, $sSave, $sCLSID, $pParams) Then Return SetError(2, 0, 0) Return True EndFunc  
    • PEscobar
      Can I make coordinates relative to a window instead of a screen?
      By PEscobar
      Can I make it so that when I put MouseClick("left", 300, 200), it will click those coordinates on a window so if I run it on a different computer or move the window, it will still click on the same spot.