Jump to content

Copy Pic,... to Clipboard


pastl
 Share

Recommended Posts

Hello erverybody,

I found this in the web, but i don't know the language. (Maby C, C++)

could anyone of yo help me to translate this into an AutoIt Script:

'by Alyce Watson

'This little demo shows how to send a bitmap to the clipboard.
'It also shows how to grab a bitmap from the clipboard and
'display it in our Liberty BASIC program.
nomainwin
WindowWidth=340:WindowHeight=480
graphicbox #1.g, 10,10,300,300
statictext #1.s, "",10,320,600,50
open "Clipboard Demo" for window as #1
print #1, "trapclose [quit]"
h=hwnd(#1)

filedialog "Open","*.bmp",bmpfile$
if bmpfile$="" then [quit]

loadbmp "forclip",bmpfile$
hBitmap=hbmp("forclip")'get bmp handle

'open clipboard:
calldll #user32, "OpenClipboard",h as long, result as long

'put bmp data on clipboard:
calldll #user32, "SetClipboardData",_CF_BITMAP as long,_
    hBitmap as long, rethandle as long

'see if bmp data is on clipboard
calldll #user32, "GetClipboardData",_CF_BITMAP as long,_
    hBmp as long

'if bmpdata is on clipboard, load the bmp and draw it
if hBmp<>0 then
    loadbmp "demo",hBmp
    print #1.g, "down;fill lightgray;drawbmp demo 0 0;flush"
end if

calldll #user32, "CloseClipboard", result as void

msg$="Return for CF_BITMAP ";hBmp
print #1.s, msg$

wait

[quit]
if hBmp<>0 then unloadbmp "demo"
close #1:end

I want to copy Pics to cilpboard, but i don't know how to handle this in AutoIt using DllCall. Thank's for your Help.

Greatings pastl

Link to comment
Share on other sites

Thank's Larry,

just one mor Question:

Why can i just "paste" the Pics from clipboard to an application (like Wordpad,...) and not to a different Folder, Drive,...?

Greatings pastl

The picture would need a file name. Windows could theoretically generate one--if I recall correctly, it was possible to save clipboard scraps *.shd files or something--but Windows doesn't do that for pictures....

When you copy and paste a file, the clipboard contains a reference to that file rather than the contents of that file....

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • 3 weeks later...

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...