On Writing graphics to MS Windows clipboard

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

Hi,

I got interested in this -- it sure seemed possible with win32Lib.  So I made
a little test window in Judith's IDE.  This code worked to send the entire
screen to MS Paint. Sending a part of the screen would be simple.  Some
version of this code might have uses in lots of other programs.  Or maybe
there is a forced Print_Screen trick to do it faster.

procedure Window1_onClick (integer self, integer event, sequence params)--params
is ()
     integer x
     object o1
     sequence screenXY
screenXY = getSystemMetrics({SM_CXSCREEN,SM_CYSCREEN}) --get the screen
     size
     x=deleteFile("C:\\screen.bmp")
while 1 do --delay to make sure the file is deleted (may not be necessary,
     should be tested)
          sleep(1)
          o1=dir("C:\\screen.bmp")
          if atom(o1) then exit end if
     end while
x=copyToTrueColorBitmapFile( Screen, "C:\\screen.bmp", 0, 0, screenXY[1],
     screenXY[2] )
while 1 do --delay to make sure the file is in fact written (the copy is
     very slo-ow)
          sleep(1)
          o1=dir("C:\\screen.bmp")
          if sequence(o1) then exit end if
     end while
    --open the file in MS Paint
x=shellExecuteEx ( "open", "ms paint", "C:\\screen.bmp", 0,
     SW_SHOWMAXIMIZED, 0 )
end procedure
setHandler( Window1, w32HClick, routine_id("Window1_onClick"))


--Quark

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

Search



Quick Links

User menu

Not signed in.

Misc Menu