Inspired by Hutch's keybd_event discovery (http://masm32.com/board/index.php?topic=8588.0):
GuiParas equ "Copy & save a window", w900, h500, b GreenBlue ; centered, width+height, background
include \masm32\MasmBasic\Res\MbGui.asm
invoke ShowWindow, hGui, SW_HIDE
MsgBox 0, "Activate the window you want to copy & save, then come back here", "Screenshotter:", MB_OKCANCEL or MB_TOPMOST
If_ eax==IDCANCEL Then invoke SendMessage, hGui, WM_CLOSE, 0, 0
invoke Sleep, 100
invoke keybd_event, VK_SNAPSHOT, 1, KEYEVENTF_EXTENDEDKEY, 0
invoke ShowWindow, hGui, SW_SHOW
Event Paint
GuiImageCallback SaveIt ; define a callback function
GuiImage clipboard, fit ; display the current screenshot
ShEx "window.jpg" ; open the default viewer, then quit
invoke SendMessage, hGui, WM_CLOSE, 0, 0
EndOfEvents
SaveIt: SaveImageToFile "window.jpg"
ret
GuiEnd
Looks good, if you want to cheeky about it, try the SetCapture technique on a mouse down message which you drag to the window you want to activate and when you release the mouse button, it captures the image of the window.
Even better: MB_TOPMOST style for the MessageBox - see new attachment above :thumbsup:
It works but has an unusual logic.