#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#include <GuiConstantsEx.au3>
Opt('MustDeclareVars', 1)
Local $hGUI, $hWnd, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout,$Pic1,$Button1,$Label1,$Label2,$nMsg,$size
Local $sString = "AU3论坛作品", $aInfo
GUISetState()
$hGUI = GUICreate("窗体1", 413, 298, 302, 218)
$hWnd = WinGetHandle("窗体1")
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\test.jpg", 0, 0, 409, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Button1 = GUICtrlCreateButton("保存", 40, 240, 97, 33, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("AU3论坛作品", 112, 16, 120, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("2009年5月27日", 264, 160, 134, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor ( $Label1, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $Label2, $GUI_BKCOLOR_TRANSPARENT )
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Main()
EndSwitch
WEnd
Func _Main()
Local $hBmp
$size = WinGetPos("窗体1")
;MsgBox(0, "活动窗口状态 (X坐标,Y坐标,宽度,高度):", $size[0] & ", " & $size[1] & ", " & $size[2] & ", " & $size[3])
_ScreenCapture_Capture (@ScriptDir & "\save.jpg", $size[0],$size[1]+24,$size[0]+$size[2]-10,$size[1]+$size[3]-91)
EndFunc
给个例子参考下吧