Jump to content
Sign in to follow this  
pastl

Copy Pic,... to Clipboard

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

Share this post


Link to post
Share on other sites

Hello Valuater,

after saving in to clipboard, i just want it back , for example with "paste" from the Contexmenu.

P.s. sorry for my english, cause i'm form austria.

Thank's for your help.

pastl

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hello erverybody,

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

If I had to guess, I'd say the language is Liberty BASIC :lmao:

I'm glad Larry was able to help

Share this post


Link to post
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....

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...