直接复制图片到剪切板,sendmessage粘贴 参考:Local $sImage = @ScriptDir & "\1.jpg"
_Clipboard_SetImage($sImage)
_SendMessageA($hChat, $WM_PASTE, 0, 0)
Func _Clipboard_SetImage($sImage, $hWnd = 0)
_GDIPlus_Startup()
Local $hImage = _GDIPlus_BitmapCreateFromFile($sImage)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
Local $aRet = DllCall('user32.dll', 'ptr', 'CopyImage', 'ptr', $hBitmap, 'int', 0, 'int', 0, 'int', 0, 'int', 0x8 + 0x4)
Local $hBitmapCopy = $aRet[0]
_ClipBoard_Open($hWnd)
_ClipBoard_Empty()
_ClipBoard_SetDataEx($hBitmapCopy, $CF_BITMAP)
_ClipBoard_Close()
_WinAPI_DeleteObject($hBitmapCopy)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_ShutDown ()
EndFunc ;==>_Clipboard_SetImage
|