News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Save clipboard image to file

Started by jj2007, May 20, 2022, 11:24:19 PM

Previous topic - Next topic

jj2007

My trusty old PaintShop can, of course, paste an image from the clipboard and save it to a file. Oh well, it could do that, but for the last ten years or so, all you see when pressing Ctrl V is this ugly little box:



Fortunately, if you only need a screenshot, you can use PaintShop's "capture" function.
Unfortunately, that function doesn't like, for reasons I don't understand, tooltips :sad:

Since I needed the tooltips for the WinAPI bubble help post, I decided to help myself and roll my own from-clipboard-to-file proggie:

GuiParas equ "Right-click into the image", w1000, h562
include \masm32\MasmBasic\Res\MbGui.asm
  GuiControl MyCanvas, "canvas"
  ArraySet MyRect() As DWORD=1, 2, 3, 4         ; dummy values

Event CanvasPaint
  ArrayPlot MyRect()
  GuiImage clipboard, fit      ; right-click into the image brings up a popup menu
  ArrayPlot exit
GuiEnd


Source & exe attached. To test it, activate any window and press Alt PrintScreen, then launch the exe and right-click into the image.

jj2007

#1
New version attached, with some improvements. As with the previous one, make sure you have an image on the clipboard, then right-click into the window.

Note the easiest way to get a screenshot from a window is Alt PrtScr

Here is an example, a screenshot of this tool's source: