从位图句柄创建位图对象
#Include <GDIPlus.au3>
_GDIPlus_BitmapCreateFromHBITMAP($hBmp[, $hPal = 0])
$hBmp | HBITMAP(16位无符号整型位图)句柄 |
$hPal | [可选参数] HPALETTE(调色板)句柄 |
成功: | 位图对象句柄 |
失败: | 返回 0 |
在MSDN中搜索
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
_Main()
Func _Main()
Local $hGUI, $hBMP, $hBitmap, $hGraphic
; 捕获屏幕的左上角
$hBMP = _ScreenCapture_Capture("", 0, 0, 400, 300)
; 创建 GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()
; 初始化 GDI+ 库
_GDIPlus_Startup()
; 在 GUI 中描绘位图
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
; 清理资源
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_BitmapDispose($hBitmap)
_WinAPI_DeleteObject($hBMP)
; 关闭 GDI+ 库
_GDIPlus_Shutdown()
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main