forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is there a need for this capability?
Goto page 1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Sun Feb 28, 2021 2:54 am    Post subject: Is there a need for this capability? Reply with quote

I posted this in "General" because it's not a bug, nor a problem. I just wonder if anyone else has worked on this.

It would be helpful to me (and my users) to be able to screen shot a window to include in a bug report. I have use of this capability to assist in providing up-to-date documentation as well.

Yes, I know I can manually do an ALT+PrtScrn and get the image of the window, but it would be helpful to have the program take the shot, make a file of the appropriate type, and save it for the User to include in an email.

It might be that ClearWin already has a capability to do that, but I am at a loss to figure out exactly how I can do that operation. Send a message to the Window?

Has anyone out there done this? And, if so, how?

Thanks, Bill
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7095
Location: Salford, UK

PostPosted: Sun Feb 28, 2021 9:35 am    Post subject: Reply with quote

Bill

Try using the accelerator key: Windows Key + Shift + S.

Then click on the box in the bottom right corner.

Here is a link to a Youtube video...

https://www.youtube.com/watch?v=fapSyhyJBKE&feature=emb_imp_woyt

There is nothing that I can think of in ClearWin+ of this nature. There will be something that you can provide but it will depend on how much you expect your users to do. For example, it is possible to provide a button that automatically sends an email to to you.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Mon Mar 01, 2021 5:48 pm    Post subject: Reply with quote

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.

Code:
   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+FCool, 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!
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Mar 02, 2021 1:33 am    Post subject: Reply with quote

Hi Bill,
Try 'Irfanview', a super (imo) FREEWARE program that does a myriad of things including screencapture.
Just start up the program, and then tap 'C' (the shortcut) then in the menu that pops up make your selections for how you want it to work.
Then just pressing the relevant 'F' key (I set to 'F12' to screen-capture what's on the screen !
Ready for cropping and saving wihin the program.
Presto !!!

Link for Irfanview: https://www.irfanview.com/

I recommend downloading installing both the program and the plugins

The installations are a doddle, just download and install the the 2 files (for either 32 or 64 bit as is your choice) and click each in turn and everything is automatic.

Good luck (let me know if you need any advice.
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Tue Mar 02, 2021 4:19 am    Post subject: Reply with quote

John, I've been using IrFanView for a couple of years now, and boy, is it a great program!

I'll look at what you are describing.

My little keyboard simulator is going to do what I want, namely save a file with a specific name (depending on the Window in use), and in the place where I want it.

My only regret (at this point) is that there is no EXPORT_PNG@() function.

Bill
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7095
Location: Salford, UK

PostPosted: Tue Mar 02, 2021 8:04 am    Post subject: Reply with quote

Bill

I think that you will find that EXPORT_IMAGE@ works for .png files.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Mar 02, 2021 11:23 am    Post subject: Reply with quote

... as is stated on page ... https://www.silverfrost.com/ftn95-help/clearwinp/library/export_image_.aspx

... although Bill probably started here Paul ... where nothing is mentioned ...
https://www.silverfrost.com/ftn95-help/clearwinp/gdialog/usingimageresources.aspx

That page probably needs updating to reflect ALL the options stated on the various individual command descriptions

a tabular format might be good if not all formats are applicable to all commands
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7095
Location: Salford, UK

PostPosted: Tue Mar 02, 2021 11:59 am    Post subject: Reply with quote

Thanks. PNG has now been added to this help topic ready for the next update.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Tue Mar 02, 2021 4:14 pm    Post subject: Reply with quote

And thanks to you, Paul! Much appreciated.

I'm finding this technique both useful and thought provoking. Thought provoking in that the %cw I have embedded in a window does not seem to be consistently "capturable" by this sequence when I scroll back, then initiate the capture. It takes additional actions on my part to "force" the image to be a reflection of what I can see. It is a minor discrepancy

Using ALT+PrntScrn does not have this limitation. I have not yet figured out how to make both techniques yield the same result. I suspect that there is something that needs to be accomplished in the callback routine to cause the %cw window to "refresh" but remain at the same scrolled position.

Still, it is working and I am incorporating it into the code. The %ud attachment to the window is the "charm" in all this!
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Tue Mar 09, 2021 3:16 pm    Post subject: Reply with quote

Just a quick update in case anyone tries this technique.

It works great unless the window you are capturing contains a %cw (like debug output), or %lv. In those two cases, when the capture is initiated using the simulated keyboard events, you may or may not actually se the control contents properly displayed.

Best I can determine, it has to do with the window being "rendered". Apparently, the system ALT+PrntScrn forces the window to be fully rendered before the image is acquired OR it is using a different image grabbing technique. I say this because I can scroll the %cw window, do my grab and then do a system grab and the images are different, mine being the "old" version before scrolling. Usually. Meaning that if I take a system screen grab first, then the image I get will match it.

It is a bit confusing to me, but that's what I am seeing. I'll work on a sample program to illustrate the issue.

So for my use right now, I am using a two-key sequence. One to use the system utility (Alt+PrntScrn OR snapshot) then a function key to get and store the clipboard image.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7095
Location: Salford, UK

PostPosted: Tue Mar 09, 2021 3:57 pm    Post subject: Reply with quote

For some purposes %re works just as well as %cw. It depends on what you need to do. There is also %eb and %tx.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Tue Mar 09, 2021 10:45 pm    Post subject: Reply with quote

Paul, thanks for the suggestion.

My %cw windows is tied to the Fortran standard output unit for diagnostic and debugging messages, and for the user, to let them know when issues are detected.

So, no, the other options are not really applicable for me.
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Sat Mar 20, 2021 1:38 pm    Post subject: Reply with quote

"It's all a matter of time."

In my case, timing. To properly get an image from a simulated PrintScreen, sufficient time following the keyboard sequence must be allowed in order for the system to acquire the appropriate image.

The SLEEP1@() call was increased to 1 full second. I also bracketed the SLEEP1@() call with SET_CURSOR_WAITING@() calls to let the user know the image was being taken. This seems to solve the problems.

As a side note, EXPORT_IMAGE@() is stated as using the %gr drawing surface to a file. Unlike EXPORT_BMP@() which uses the HDIB to point to the memory that contains the DIB. When I tried using the EXPORT_IMAGE@() function, I saw no file created and no error thrown. My active window does not have a %gr area; this is what I anticipated.
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Mar 21, 2021 9:35 pm    Post subject: Reply with quote

... so, one is restricted to capturing as a .bmp file ?
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1003
Location: Morrison, CO, USA

PostPosted: Sun Mar 21, 2021 9:50 pm    Post subject: Reply with quote

John, no, I could have saved to a GIF or PCX. These three file types appear to be the only ones that can used the HDIB handle and create the file.

I don't see any way to take an HDIB handle and create an internal DIB data array. If I could do that, then the number of options gets broader to include PNG and JPG as possible outputs. PNG is my preference.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group