Author Topic: Save clipboard image to file  (Read 303 times)


  • Member
  • *****
  • Posts: 12930
  • Assembler is fun ;-)
    • MasmBasic
Save clipboard image to file
« on: May 20, 2022, 11:24:19 PM »
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

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