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 Previous  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
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Mon Mar 22, 2021 1:34 am    Post subject: Reply with quote

Bill, I still do not get what do you want. Do you want the program which is independent of your program so that if your program crashes you can save the bug report? For that i use Snaggit which saves pictures or movies from any part of the screen you highlight with just one click before recording into MP4 file.

Or you want just to save the whole screen like PrintScreen is doing but different way through just one button or one combination of keys programmed by your own way in your own FTN95 program? In this case if your program crash you will not save any bug reports. But you still can save the bug report after you PrintScreen it usual Windows way and start your program again and save the clipboard information stored by PrintScreen into PCX and BMP files. I do that 25 years using Clearwin. Of course this one click saving of screen you made yourself for yourself is more convenient than a dozen of manipulations Windows way.
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Mon Mar 22, 2021 3:32 am    Post subject: Reply with quote

Dan, no, and I see the confusion. First off, this capability is BUILT-IN to the program. I create a window AND a function key to take a snapshot. And, I name the image in my code ahead of time.

If I get an error (crash), my users are told how to take the information. Not that they actually do it, but they do sometimes. That is not what this capability is designed to do for me.

This is 2-fold capability.

For my users: If they have a screen/window they don't understand, they can get it, and send me the image. Not all of them are really computer savvy, and can included a clipboard image into an e-mail. Those that can, do just that. What can I say?

For me: As I modify/change the user interface, it is important to grab a screen shot for the on-line help documentation. With a specific name (the default is in my code). So my interface allows me to name each screen that can be grabbed by this method and save the image with the correct name for later inclusion. The latter part allows me to use my memory for other things!

That's what I am doing with it.

Bill
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Mar 25, 2021 12:27 am    Post subject: Reply with quote

What could be done here more is to make instead of two steps save of the whole screen just one click save. Do anyone know what WinAPI command doing the action analogous to PrintScreen button push on keyboard which is to save the whole screen into clipboard?

Then instead of PrintScreen Button Push on keyboard + Save button Click on my program like i do today, i will just do one click and the whole screen will be saved into my preferred destination.

Additionally, i see that i have only 2 options to save - PCX and BMP. I did not touch this part for decades, do we have now PNG and JPG options as well?
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Mar 25, 2021 3:00 am    Post subject: Reply with quote

My approach is a "DUMP" menu option which dumps a .png file of the active window using export_image@ (file_png), where file_png is an automatically generated file name with an optional extension of .png, .jpg, .pcx, .gif or .bmp.
(check the latest documentation for export_image@)

I do find that .png is the best option and is what I always select.

"automatic" name generation can be a problem, as you can forget what file name refers to what image, which Bill did indicate he has better addressed.
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Thu Mar 25, 2021 4:32 pm    Post subject: Reply with quote

Dan, what I did is exactly what you describe, but I assigned a function key to the callback. And, yes, currently for a non=%gr window, you have to emulate the Alt+PrntScrn key sequence (with delays), then can save only as BMP or PCX. Paul has said that PNG will be added at the next release.

John, from the documentation, the export_image@() is useful only for graphics windows (%gr) which I am not using. Therefore PNG etc. are not available to be saved. I did try the export_image@() call in my code (JIC), but nothing was saved and there was no error message or fault detected.

Here's a stripped down version of how I have the Alt+PrntScrn working.

Code:

        call keybd_event(VK_MENU,       z'45', KEYEVENTF_EXTENDEDKEY,                   0)!; //Alt Press
        call keybd_event(VK_SNAPSHOT,   z'45', KEYEVENTF_EXTENDEDKEY,                   0)!; //PrntScrn Press


        call keybd_event(VK_SNAPSHOT,   z'45', KEYEVENTF_KEYUP+KEYEVENTF_EXTENDEDKEY,   0)!; //PrntScrn Release
        call keybd_event(VK_MENU,       z'45', KEYEVENTF_KEYUP+KEYEVENTF_EXTENDEDKEY,   0)!; //Alt Release

        call set_cursor_waiting@(1)
        call sleep1@(2.0) ! sleep long enough to allow the image to be grabbed from the open window
        call set_cursor_waiting@(0)

        my_error=sizeof_clipboard_bitmap@(actual_width,actual_height) ! will detect if the capture actually did work
        if(my_error.ne.0) then ! the capture worked
                if(clipboard_to_screen_block@(hdib).ne.0) then ! this does the grab into local memory
                        call export_bmp@(hdib,NEW_FILENAME,my_error)
                        call release_screen_dib@(hdib) ! release the memory  clipboard_to_screen_block@()
                endif
        endif
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 25, 2021 7:36 pm    Post subject: Reply with quote

Bill

Can you remind me about what is missing.
Back to top
View user's profile Send private message AIM Address
wahorger



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

PostPosted: Thu Mar 25, 2021 8:13 pm    Post subject: Reply with quote

Paul,

I believe export_png@() and export_JPG@() using the arguments for HDIB, file name, and error code would be most helpful to round out the capability.

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


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

PostPosted: Fri Mar 26, 2021 8:29 am    Post subject: Reply with quote

Thanks. I have made a note of this request.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Mon Mar 29, 2021 3:05 pm    Post subject: Reply with quote

Bill

Here is a sample of what you can do at the moment. Can you post a similar program that illustrates what you want.

Code:
 WINAPP
 USE clrwin
 INTEGER hres,vres,nbbp,ercode,hdib,ctrl,i
 CHARACTER(*),PARAMETER :: file = "guest.bmp"
 CALL get_dib_size@(file,hres,vres,nbbp,ercode)
 IF(ercode /= 0)THEN; i = winio@('get_dib_size@ error'); STOP; ENDIF 
 hdib = import_bmp@(file,ercode)
 IF(ercode /= 0)THEN; i = winio@('import_bmp@ error'); STOP; ENDIF 
 i = winio@('%gr[rgb_colours]%lw',hres,vres,ctrl)
 ercode = dib_paint@(0,0,hdib,0,0)
 IF(ercode == 0)THEN; i = winio@('dib_paint@ error'); STOP; ENDIF 
 call draw_line_between@(0,0,hres,vres,RGB@(255,0,0))
 i = export_image@("guest1.png")
 IF(ercode == 0) i = winio@('export_image@ error')
 CALL release_screen_dib@(hdib)
 END
Back to top
View user's profile Send private message AIM Address
wahorger



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

PostPosted: Tue Mar 30, 2021 11:50 pm    Post subject: Reply with quote

Paul,

I see what you have done by creating a window into which the image from a file is written,. then modified, and written to a PNG.

While I have not tried it, I would imagine that this technique would work with the clipboard image. I would also imagine that I could create the window as invisible to prevent the "flash" of the image to the user.

I will give this a try. I look at this as a stop-gap method, and your description of this in your code is much appreciated!

Thanks, Paul,
Bill
Back to top
View user's profile Send private message Visit poster's website
wahorger



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

PostPosted: Wed Mar 31, 2021 12:08 am    Post subject: Reply with quote

This does work well with the clipboard image. I did have to add a %ww[invisible] to prevent the "flash" of the graphics area to the user.

Thanks, Paul, for helping me better understand these capabilities, and an alternate way to get the job done!

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


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

PostPosted: Wed Mar 31, 2021 7:32 am    Post subject: Reply with quote

Bill

My purpose in posting the program was to ask you to modify it and post it back in a the form that you would like it to work. It wasn't clear to me what you were asking for. You can make up and write in the name of a new ClearWin+ routine if that is what is needed.
Back to top
View user's profile Send private message AIM Address
wahorger



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

PostPosted: Wed Mar 31, 2021 3:15 pm    Post subject: Reply with quote

This would be how I would like to see it work with the simulated keystrokes and clipboard being used for the image source:

Code:

        call keybd_event(VK_MENU,       z'45', KEYEVENTF_EXTENDEDKEY, 0)!; //Alt Press
        call keybd_event(VK_SNAPSHOT,z'45', KEYEVENTF_EXTENDEDKEY, 0)!; //PrntScrn Press
        call keybd_event(VK_SNAPSHOT,z'45', KEYEVENTF_KEYUP+KEYEVENTF_EXTENDEDKEY,   0)!; //PrntScrn Release
        call keybd_event(VK_MENU,       z'45', KEYEVENTF_KEYUP+KEYEVENTF_EXTENDEDKEY,   0)!; //Alt Release

        call set_cursor_waiting@(1)
        call sleep1@(2.0) ! sleep long enough to allow the image to be grabbed from the open window
        call set_cursor_waiting@(0)

        my_error=sizeof_clipboard_bitmap@(actual_width,actual_height) ! will detect if the capture actually did work
        if(my_error.ne.0) then ! the capture worked
                if(clipboard_to_screen_block@(hdib).ne.0) then ! this does the grab into local memory
                        call export_png@(hdib,NEW_FILENAME,my_error) ! **** this is the routine that I would like to see ****
                        call release_screen_dib@(hdib) ! release the memory
                endif
        endif
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Mar 31, 2021 4:36 pm    Post subject: Reply with quote

Bill

Here is a way to do it with the existing routines...

Code:
        use clrwin
        integer, parameter::grhandle = 42
        integer(7) hdib
        integer actual_width,actual_height,my_error
        my_error=sizeof_clipboard_bitmap@(actual_width,actual_height)
        if(my_error.ne.0) then
           if(clipboard_to_screen_block@(hdib).ne.0) then
              my_error = create_graphics_region@(grhandle, actual_width,actual_height)
              my_error = dib_paint@(0,0,hdib,0,0)
              my_error = export_image@("image.png")
              my_error = delete_graphics_region@(grhandle)
              call release_screen_dib@(hdib)
           endif
        endif
        end
Back to top
View user's profile Send private message AIM Address
wahorger



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

PostPosted: Wed Mar 31, 2021 4:45 pm    Post subject: Reply with quote

Awesome! I'll give this a try today.

I would have not come up with this on my own; thank you for taking the time! I also hope it saves you additional work; I perceive you are busy enough as it is.

Thanks!
Bill
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 Previous  1, 2, 3, 4, 5  Next
Page 2 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