Re: How to write graphics to MS Windows clipboard

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> A way nicer version using a Pixmap:
> }}}
<eucode>
> include win32lib.ew
> 
> integer void
> global procedure bmpToClipboard(atom hBmp) 
> -- hBmp must be a bitmap handle
>     if not w32Func(xOpenClipboard, {NULL}) then
>         void=message_box("Failed to open
>         clipboard.","Error",MB_ICONERROR+MB_OK)
>         return
> 	end if
<SNIP>
> constant
> w=create(Window,"test",0,50,50,300,300,0)
> ,b=create(Button,"push",w,20,200,60,30,0)
> 
> procedure q(integer self,integer event,sequence data)
> setWindowBackColor(w,Green)
> setPenColor(w,Red)
> drawRectangle(w,w32True,100,100,200,200)
> end procedure
> setHandler(w,w32HActivate,routine_id("q"))
> 
> procedure p(integer self,integer event,sequence data)
> captureToClipboard(w,30,80,100,120)
> end procedure
> setHandler(b,w32HClick,routine_id("p"))
> 
> WinMain(w,Normal)
> </eucode>
{{{

> Both routine work and the clipboard holds he expected value.
> 
> I'll have to add support for full window DCs in the library so that the
> distinction wbetween the non -Ex and -Ex routines is no longer necessary.
> 
> Also, I had noticed earlier, and forgotten, that if you call
> registerw32function() on some dll routine, then define_c_func() returns -1
> if invoked on the same routine thereafter. I'll have to investigate.
> Derek, any idea?
> 
> CChris

Thanks, that works like a charm.

Do you think a bitmap-in-memory can be sent (with OLE or DDE or whatever) to
be pasted into some other program?  It isn't uncommon to see programs do
this, such as IrfanView's send of an image that does not exist as a disk file
to some other graphic editor.

--Quark

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu