Jump to content

Put JPG to Clipboad, how ?


Recommended Posts

Moin,

I want to copy an Image or Picture - png, gif, jpg - to the Clipboard, so I played around with _ClipPutFile() and _Clipboard_SetData(), but everything failes.

With Bitmaps it is no problem, so what's the thing that makes these formats so difficult to handle ?!

I tried _Clipboard_SetData() with $CF_BITMAP and $CF_METAFILEPICT with the same results: No go !

#include<Clipboard.au3>
$file = "C:\test.jpg"
_ClipBoard_Open(0)
_ClipBoard_Empty()
_ClipBoard_SetData($file, $CF_METAFILEPICT) ; failes
_ClipBoard_Close()

_ClipPutFile($file) ; failes also

I found a Topic here to get a Picture to the Clipboard, by creating an Object, but it also didn't work in my tests ...

Could anybody give me a tip how to get a png, gif or jpg to the Clipboard, please ?

Greetz

Greenhorn

Edited by Greenhorn
Link to comment
Share on other sites

Could anybody give me a tip how to get a png, gif or jpg to the Clipboard, please ?

First, let me just say, I don't know.

I just want to clear up some confusion I have about your question so I know what you're trying to do: Are you trying to put a file that is a .jpg on the clipboard so you could paste it elsewhere (like in explorer), or are you trying to put the data of the .jpg image itself on the clipboard so you could paste it into a program (like paint)? I think there's a significant difference between these two things... (though I could be wrong here too).

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

First, let me just say, I don't know.

I just want to clear up some confusion I have about your question so I know what you're trying to do: Are you trying to put a file that is a .jpg on the clipboard so you could paste it elsewhere (like in explorer), or are you trying to put the data of the .jpg image itself on the clipboard so you could paste it into a program (like paint)? I think there's a significant difference between these two things... (though I could be wrong here too).

I want to paste the Picture into other Progs like Paint or any other Application, but the first possibility is also interesting.

How could I put the Data of an Image to the Clipboard ? That's the main question that tortures me ! :D

Greetz

Link to comment
Share on other sites

I want to paste the Picture into other Progs like Paint or any other Application, but the first possibility is also interesting.

How could I put the Data of an Image to the Clipboard ? That's the main question that tortures me ! :D

Greetz

HI,

yes. I would also like to know how to say clipboard - hey ho now there comes a jpg or png or something.

And after it, I can paste it to word, excel, msapint or some other programm that does understand that.

It works when I am using a screenshot tool, but how does a screenshottool store the data into clipboard? Is this even possible from file or do I always have to show the pic on screen and then put it into clipbaord?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi Mega,

you know where the original post is from, didn't you ? :D

O.K., I took a deeper look into _ClipBoard_SetData and I think it's possible with _GDIPlus_ImageLoadFromFile.

But how do I create a $hMemory from the returned _GDIPlus_ImageLoadFromFile ???

#include<Clipboard.au3>
#Include <GDIPlus.au3>

$sFileName = "J:\Eigene Dateien\Eigene Bilder\Diverses\AutoIt3port.jpg"
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sFileName)
_ClipBoard_Open(0)
_ClipBoard_Empty()
_ClipBoard_SetData($hImage, $CF_METAFILEPICT ) ; failes
_ClipBoard_Close()
_GDIPlus_ShutDown()

Any experiences and/or ideas out there ?

Greetz

Greenhorn

Link to comment
Share on other sites

  • 2 years later...

So did this question ever get an answer ? Im stuck with exactly the same problem.

this was asked some 2 years ago so im assuming there was an answer that im just not finding on the forum.

Anyone , pls

Many thx.

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...