Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:41 am
by Craig Shearer >> Tue, 22 Jun 1999 0:44:44 GMT
Well, I don't know about your problems with the createPicture method, but I had to do the same thing - copy the contents of a picture control to the clipboard. Here's the code I came up with. Note, this is a method I added to the Picture control. Also, there are lots of Windows API calls here that you'd need to setup as external functions within JADE.
copyToClipboard(): Boolean;
/*
Date: 19 February 1999 by CDS
Description:
Copies the picture in the control to the clipboard.
Returns:
False is anything goes wrong, otherwise true.
*/
constants
CF_BITMAP = 2;
SRCCOPY = #CC0020;
vars
dc : Integer;
compatibleDC : Integer;
hBmp : Integer;
begin
dc := call getDC(hwnd);
compatibleDC := call createCompatibleDC(dc);
hBmp := call createCompatibleBitmap(dc, width.Integer, height.Integer); if hBmp = 0 then
return false;
endif;
if call selectObject(compatibleDC, hBmp) = 0 then
return false;
endif;
if call bitBlt
(
compatibleDC,
0,0,
width.Integer, height.Integer,
dc,
0,0,
SRCCOPY
) = 0 then
return false;
endif;
if call openClipboard(null) > 0 then
call emptyClipboard;
call setClipboardData(CF_BITMAP, hBmp);
call closeClipboard;
return true;
else
return false;
endif;
epilog
call releaseDC(hwnd, dc);
call deleteDC(compatibleDC);
call deleteObject(hBmp);
end;