Paul, thanks for your response.
I want to make sure the user doesn't need to do much to achieve the capture. Using the Screen Snapshot is something I've been doing for my documentation. My workflow to get it in to documentation requires 9 steps, from snagging the image all the way through post-processing the image for the documentation. I want to make that simpler as well, and I think I can do that now. I want the user to only have to press one set of keys (using an accelerator), then drag-and-drop the image from that specific location into an e-mail. For some of my users, even that is asking a lot!
After I posted my original question, I stumbled across a Stack Overflow discussion and one of the techniques got my attention. You have to look about half way down the discussion to see it. It was using VK_* which reminded me of something I'd seen in the FTN95 documentation regarding %eb. So I poked around the MOD and INS files and found the references to the constants, and tried the code. It works!
https://stackoverflow.com/questions/24985315/c-program-to-take-a-screenshot
The FTN95 program I used to test this only fills the clipboard with the window, but does nothing more. I'm still working on expanding that part (successfully); not yet ready to share the details. It uses clipboard_to_screen_block@() and export_bmp@() and that part is working in a test mode. Stated another way, I can press the key sequence and a copy of the current window is made to a file.
My little test program is below, just grabbing the open window and getting it into the clipboard, nothing more.
winapp
PROGRAM MAIN
use mswin
integer:: i,j,width,height
i = winio@('This is a test%lw',j)
call keybd_event(VK_MENU, 0, 0, 0)!; //Alt Press
call keybd_event(VK_SNAPSHOT, 0, 0, 0)!; //PrntScrn Press
call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)!; //PrntScrn Release
call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)!; //Alt Release
call sleep1@(0.5) ! this was 0.1 in the 'C' program
if(sizeof_clipboard_bitmap@(width,height).ne.0) then
print *,width,height
pause
endif
end
There are some things about this that don't quite work in the 'real world' testing as I'd like. It seems I have to do the control sequence twice to get the first one done. It is like the first set of sequences gets 'lost'. But, after the first one, it all seems to work just fine. It might be that I am pressing the keys when the accelerator is recognized (CTRL+SHIFT+F8), and if I choose a different key sequence (a single F key perhaps), it will work more reliably. I may need to flush the keyboard buffer before I simulate the screen grab. etc. etc.
And, maybe this has some other unintended consequences. I'll let you know what I find!