Skip to main content

[archive] Graphical print screen

  • January 30, 2003
  • 21 replies
  • 0 views

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it

21 replies

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
My compliments for being innovative. Very elegant solution. Just remember to bring along the vic32.dll. And, for those of you recompiling, note the use of signed-long and unsigned-long. As these are platform independent sizes, you should compile with -dl4 -dw32 options to ensure proper memory allocation and alignment.

For those that are not so stiff in Italian, here is a boiled down version that captures the screen and stores it to a filename provided by linkage section:

PROGRAM-ID. WinPrtScr is initial.
*This program makes a screen shot, and saves it to a bitmap file
*using the passed filename.
*This file may later then be used with W$BITMAP functions in
*ACUCOBOL-GT
*Credits to ACUCORP Italy

WORKING-STORAGE SECTION.
01 OrgDLLConv PIC X(10).
01 Result PIC S9(9) COMP-5.

01 WndHandle PIC S9(9) COMP-5.
01 ResImg.
03 IBuff PIC 9(9) COMP-5.
03 Stx PIC 9(9) COMP-5.
03 Sty PIC 9(9) COMP-5.
03 Endx PIC 9(9) COMP-5.
03 Endy PIC 9(9) COMP-5.
03 BuffWidth PIC 9(9) COMP-5.
03 Palette PIC 9(9) COMP-5.
03 ImgColors PIC 9(9) COMP-5.
03 ImgType PIC 9(9) COMP-5.
03 Bmh PIC 9(9) COMP-5.
03 hBitmap PIC 9(9) COMP-5.

LINKAGE SECTION.
01 SaveToName PIC X(256).

PROCEDURE DIVISION USING SaveToName.
MAIN-LOGIC SECTION.
MAIN-LOGIC-001.

INITIALIZE RESULT.
ACCEPT OrgDLLConv FROM ENVIRONMENT
"DLL_CONVENTION".
SET ENVIRONMENT "DLL_CONVENTION" TO "1".
CALL "VIC32.DLL" ON EXCEPTION
GO TO MAIN-LOGIC-800.
INQUIRE WINDOW SYSTEM HANDLE IN WndHandle.
CALL "windowtoimage" USING
BY VALUE WndHandle
BY REFERENCE ResImg.
INSPECT SaveToName REPLACING TRAILING SPACES BY
LOW-VALUES.
CALL "savebmp" USING
BY REFERENCE SaveToName
BY REFERENCE ResImg
BY VALUE 0
GIVING RESULT.
INSPECT SaveToName REPLACING ALL LOW-VALUES BY SPACES.
CALL "freeimage" USING
BY REFERENCE ResImg.
SET ENVIRONMENT "DLL_CONVENTION" TO
OrgDLLConv.
GO TO MAIN-LOGIC-900.

MAIN-LOGIC-800.

MOVE 1 TO RESULT.

MAIN-LOGIC-900.

CANCEL "VIC32.DLL".
GOBACK RETURNING RESULT.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
I noticed the twain support dll(victw32.dll) for the victor library is not included with the acucorp runtime. According to catenary website there is no seperate fee for this dll, just that it is a seperate dll file. Is there any reason why acucobol developers couldn't use this dll alongside vic32.dll without breaking any license issues? If this was a problem, could acucorp start to distribute it with the runtime?

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
I noticed the twain support dll(victw32.dll) for the victor library is not included with the acucorp runtime. According to catenary website there is no seperate fee for this dll, just that it is a seperate dll file. Is there any reason why acucobol developers couldn't use this dll alongside vic32.dll without breaking any license issues? If this was a problem, could acucorp start to distribute it with the runtime?

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
We have included the vic32.dll because of a need for some functionality some time ago. We did not need the twain functionality, hence we did not include it. In the future, we may not even need vic32.dll anymore.
Hence, it is a possibility that we may no longer distribute vic32.dll, and we are not planning on including the twain dll you refer to.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
We have included the vic32.dll because of a need for some functionality some time ago. We did not need the twain functionality, hence we did not include it. In the future, we may not even need vic32.dll anymore.
Hence, it is a possibility that we may no longer distribute vic32.dll, and we are not planning on including the twain dll you refer to.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
It is very interristing to get a print screen directly in a file .. but now i would like to apply this print screen from : even my windows desktop (like direct printscreen not like alt printscreen), even a calling window (in this case, how to know, without passing the handle in linkage, the handle of the calling window)

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In order to get the Windows handle of ACUCOBOL-GT main window, you can use the external variable H-ACU-WND.
Declare it like this:

77 H-ACU-WND PIC 9(9) COMP-5 EXTERNAL.

Once the window is shown, this variable will have the handle to it.

However, to make a screen shot of an application window into the clipboard, you don't have to know this. You can just programmatically simulate the printscreen command through the keyboard. Here we go:

IDENTIFICATION DIVISION.
PROGRAM-ID. WINPRTSCR.
AUTHOR. (c) 1999, ACUCORP, Cheesle.
REMARKS.
*This program must be compiled with -Dw32 -Dl4
*For use with 32 bit Windows only
*This program demonstrates how to perform a printscreen from an
*Acucobol application.
*This program is free of use for Acucorp customers, provided as is.
DATA DIVISION.
WORKING-STORAGE SECTION.

01 VK-SNAPSHOT SIGNED-SHORT.
01 COPY-MODE SIGNED-SHORT.
01 WS-NULL1 SIGNED-INT.
01 WS-NULL2 SIGNED-INT.

SCREEN SECTION.

PROCEDURE DIVISION.
MAIN SECTION.
MAIN-001.

*Set COPY-MODE to 0 to perform a printscreen of the entire screen,
*Set COPY-MODE to 1 to perform a printscreen of your applications
* window.
SET ENVIRONMENT "DLL_CONVENTION" TO "1".
MOVE 0 TO COPY-MODE.
MOVE 44 TO VK-SNAPSHOT.
MOVE 1 TO WS-NULL1
WS-NULL2.
DISPLAY "Prepare for snapshot...".
CALL "USER32.DLL" ON EXCEPTION GO TO MAIN-900.

CALL "keybd_event" USING
BY VALUE VK-SNAPSHOT
BY VALUE COPY-MODE
BY VALUE WS-NULL1
BY VALUE WS-NULL2
ON EXCEPTION GO TO MAIN-900.
*Your printscreen is now stored as a bitmap in the clipboard

DISPLAY "Done...".
ACCEPT OMITTED.
CANCEL "USER32.DLL".

MAIN-900.
MAIN-EXIT.
GOBACK.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In order to get the Windows handle of ACUCOBOL-GT main window, you can use the external variable H-ACU-WND.
Declare it like this:

77 H-ACU-WND PIC 9(9) COMP-5 EXTERNAL.

Once the window is shown, this variable will have the handle to it.

However, to make a screen shot of an application window into the clipboard, you don't have to know this. You can just programmatically simulate the printscreen command through the keyboard. Here we go:

IDENTIFICATION DIVISION.
PROGRAM-ID. WINPRTSCR.
AUTHOR. (c) 1999, ACUCORP, Cheesle.
REMARKS.
*This program must be compiled with -Dw32 -Dl4
*For use with 32 bit Windows only
*This program demonstrates how to perform a printscreen from an
*Acucobol application.
*This program is free of use for Acucorp customers, provided as is.
DATA DIVISION.
WORKING-STORAGE SECTION.

01 VK-SNAPSHOT SIGNED-SHORT.
01 COPY-MODE SIGNED-SHORT.
01 WS-NULL1 SIGNED-INT.
01 WS-NULL2 SIGNED-INT.

SCREEN SECTION.

PROCEDURE DIVISION.
MAIN SECTION.
MAIN-001.

*Set COPY-MODE to 0 to perform a printscreen of the entire screen,
*Set COPY-MODE to 1 to perform a printscreen of your applications
* window.
SET ENVIRONMENT "DLL_CONVENTION" TO "1".
MOVE 0 TO COPY-MODE.
MOVE 44 TO VK-SNAPSHOT.
MOVE 1 TO WS-NULL1
WS-NULL2.
DISPLAY "Prepare for snapshot...".
CALL "USER32.DLL" ON EXCEPTION GO TO MAIN-900.

CALL "keybd_event" USING
BY VALUE VK-SNAPSHOT
BY VALUE COPY-MODE
BY VALUE WS-NULL1
BY VALUE WS-NULL2
ON EXCEPTION GO TO MAIN-900.
*Your printscreen is now stored as a bitmap in the clipboard

DISPLAY "Done...".
ACCEPT OMITTED.
CANCEL "USER32.DLL".

MAIN-900.
MAIN-EXIT.
GOBACK.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
Does this also work with Thin Client?

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
Does this also work with Thin Client?

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
It would require DLL support to do print screen either way, which currently are not supported by Thin Client.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In the first example above, is there a way to reduce the bits per pixel when saving it to a file? As the default for many screens these days is either 32 or 24 which is quite a large file when saving the entire desktop.

I have tried using the w$bitmap desktop-capture with different color-depths, but this doesn't seem to do anything in either version 6.2 or 7.0, I end up with a 5 Meg file, which is not suitable for sending via email everytime. I don't care if it is even 1 bit per pixel.

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In the first example above, is there a way to reduce the bits per pixel when saving it to a file? As the default for many screens these days is either 32 or 24 which is quite a large file when saving the entire desktop.

I have tried using the w$bitmap desktop-capture with different color-depths, but this doesn't seem to do anything in either version 6.2 or 7.0, I end up with a 5 Meg file, which is not suitable for sending via email everytime. I don't care if it is even 1 bit per pixel.

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In the first example above, is there a way to reduce the bits per pixel when saving it to a file? As the default for many screens these days is either 32 or 24 which is quite a large file when saving the entire desktop.

I have tried using the w$bitmap desktop-capture with different color-depths, but this doesn't seem to do anything in either version 6.2 or 7.0, I end up with a 5 Meg file, which is not suitable for sending via email everytime. I don't care if it is even 1 bit per pixel.

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
In the first example above, is there a way to reduce the bits per pixel when saving it to a file? As the default for many screens these days is either 32 or 24 which is quite a large file when saving the entire desktop.

I have tried using the w$bitmap desktop-capture with different color-depths, but this doesn't seem to do anything in either version 6.2 or 7.0, I end up with a 5 Meg file, which is not suitable for sending via email everytime. I don't care if it is even 1 bit per pixel.

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
Regretably a bug sneaked in on this feature. It is corrected in version 7.2.0, with that one you will be able to decide the color intensity as promised.

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
Thanks for that. But can I use the vic32.dll to save the image to a smaller file? And if so how?

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
Thanks for that. But can I use the vic32.dll to save the image to a smaller file? And if so how?

Regards

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
I am sure you can do this with the dll, their documentation is available online:
http://www.catenarysystems.com/docs/viclibref-a-c.html

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
I am sure you can do this with the dll, their documentation is available online:
http://www.catenarysystems.com/docs/viclibref-a-c.html

[Migrated content. Thread originally posted on 28 January 2003]

If someone wan't to have a print screen or other great thing you could go to http://www.acucorp.it
I found a great little activex component called GDPicturePro. It does exactly what I want and works great with thinclient, and its cheap.

http://www.gdpicture.com/

Regards