#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <Process.au3>
#include <array.au3>
#include <GDIPlus.au3>
local $url="http://WWW.SOHU.COM"
local $title="[CLASS:IEFrame]"
local $hWnd=NULL
local $hWnd2=NULL
_GDIPlus_Startup()
Run(@programFilesDir & "\Internet Explorer\iexplore.exe " & $url)
WinWait($title, "", 10)
WinSetState($title, "", @SW_HIDE)
do
$hWnd2=WinGetHandle($title)
until $hWnd2
WinMove($hWnd2,"",3000,3000,1600,800)
WinSetState($hWnd2, "", @SW_SHOW)
Sleep(100)
$hWnd=ControlGetHandle($title,"","Internet Explorer_Server1")
Local $iSize = WinGetPos($hWnd)
local $hPic=$hWnd
Local $hDC = _WinAPI_GetDC($hPic);取得控件的环境句柄
Local $hDestDC = _WinAPI_CreateCompatibleDC($hDC);创建兼容的内存环境,返回内存环境句柄
Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iSize[2], $iSize[3]);创建画布,返回画布句柄
Local $hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap);把画布放到内存环境里去,返回之前的对象的句柄
Local $hSrcDC = _WinAPI_CreateCompatibleDC($hDC);再创建一个内存环境。
Local $hBmp = _WinAPI_CreateCompatibleBitmap($hDC, $iSize[2], $iSize[3]);再创建一个画布。
Local $hSrcSv = _WinAPI_SelectObject($hSrcDC, $hBmp);然后把第二画布放到第二个内存环境里去。
_WinAPI_PrintWindow($hWnd, $hSrcDC);复制程序窗口到第2个内存环境中去。
_WinAPI_BitBlt($hDestDC, 0, 0, $iSize[2], $iSize[3], $hSrcDC, 0, 0, $MERGECOPY)
;从第二个内存环境中传输位图信息到第一个内存环境。
_WinAPI_ReleaseDC($hPic, $hDC);释放控件的环境句柄
_WinAPI_SelectObject($hDestDC, $hDestSv);还原内存环境
_WinAPI_SelectObject($hSrcDC, $hSrcSv);;还原内存环境
_WinAPI_DeleteDC($hDestDC);删除内存环境句柄
_WinAPI_DeleteDC($hSrcDC);删除内存环境句柄
_WinAPI_DeleteObject($hBmp);删除第二个位图
local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
; 创建 24 位位图克隆
local $iX = _GDIPlus_ImageGetWidth($hImage)
local $iY = _GDIPlus_ImageGetHeight($hImage)
local $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, 1000, 700, $GDIP_PXF24RGB)
_GDIPlus_ImageSaveToFile($hClone, @desktopDir & "\GDIPlus_Image.bmp")
_GDIPlus_ImageDispose($hClone)
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()
while ProcessExists("iexplore.exe")
ProcessClose("iexplore.exe")
WEnd
exit
|