fenhanxue Posted January 15, 2018 Posted January 15, 2018 (edited) i want to copy a picture file to clipboard, so that i can paste the picture through ctrl+V this is my code ,but it dosen't work : #AutoIt3Wrapper_UseX64 = n #Include <Clipboard.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\1.jpg') _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() _GDIPlus_Shutdown() can you help me Edited January 15, 2018 by fenhanxue
water Posted January 15, 2018 Posted January 15, 2018 _ClipPutFile("<your filename goes here>") krasnoshtan 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
fenhanxue Posted January 15, 2018 Author Posted January 15, 2018 4 minutes ago, water said: _ClipPutFile("<your filename goes here>") _ClipPutFile can't meet my demands: when I use OICQ ( IM) , It won't paste the picture ,but send the pic
water Posted January 15, 2018 Posted January 15, 2018 The problem you face is not caused by _ClipPutFile (as it simply writes the file to the clipboard) but the way OICQ handles Ctrl+V. Run _ClipPutFile and then use Ctrl+V in Word and you'll see what I mean. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
fenhanxue Posted January 15, 2018 Author Posted January 15, 2018 7 minutes ago, water said: The problem you face is not caused by _ClipPutFile (as it simply writes the file to the clipboard) but the way OICQ handles Ctrl+V. Run _ClipPutFile and then use Ctrl+V in Word and you'll see what I mean. IF I use this code : $hClipboard_Bitmap = _ScreenCapture_Capture('',0,0,300,300) _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() Ctrl+V will paste the pic in OICQ i wonder why the following code doesn't work: $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\Users\s\Desktop\1.jpg') _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close()
UEZ Posted January 15, 2018 Posted January 15, 2018 (edited) Something like this here? $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\Users\s\Desktop\1.jpg') $hClipboard_BitmapGDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClipboard_Bitmap) $hHBmp_Clipboard = _WinAPI_CopyImage($hClipboard_BitmapGDI, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG)) _WinAPI_Bitmap2Clipboard($hHBmp_Clipboard) Func _WinAPI_Bitmap2Clipboard($hHBitmap) If Not _ClipBoard_Open(0) Then Return 1 If Not _ClipBoard_Empty() Then Return 2 Local Const $hCP = _ClipBoard_SetDataEx($hHBitmap, $CF_BITMAP) If Not $hCP Or @error Then Return 3 _ClipBoard_Close() Return 0 EndFunc Edited January 15, 2018 by UEZ robertocm and fenhanxue 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
fenhanxue Posted January 15, 2018 Author Posted January 15, 2018 6 minutes ago, UEZ said: Something like this here? $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\Users\s\Desktop\1.jpg') $hClipboard_BitmapGDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClipboard_Bitmap) _WinAPI_Bitmap2Clipboard($hClipboard_BitmapGDI) Func _WinAPI_Bitmap2Clipboard($hHBitmap) If Not _ClipBoard_Open(0) Then Return 1 If Not _ClipBoard_Empty() Then Return 2 Local Const $hCP = _ClipBoard_SetDataEx($hHBitmap, $CF_BITMAP) If Not $hCP Or @error Then Return 3 _ClipBoard_Close() Return 0 EndFunc it dosen't work
UEZ Posted January 15, 2018 Posted January 15, 2018 (edited) You have to init GDI+ first of course. Did you? Sorry, I had forgotten one additional line. Check out the code above again. Edited January 15, 2018 by UEZ fenhanxue 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
fenhanxue Posted January 15, 2018 Author Posted January 15, 2018 (edited) 9 minutes ago, UEZ said: You have to init GDI+ first of course. Did you? Sorry, I had forgotten one additional line. Check out the code above again. Thank you very much 。it works .Thank you Edited January 15, 2018 by fenhanxue
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now