|GUI ScreenIO for Windows|
This API sends a screen shot of the current panel to the printer. It will print just the panel's client area (no windows title bar), or the panel's entire window (title bar, status bar etc.), or the entire desktop, depending on the options you select.
You can buy utilities to generate screen prints via the Print-Screen Key, or you can use the Print-Screen key to put an image in the clipboard and then paste that image into a document. However, we supply this API so that you can trigger a screen print under program control without the use of either the clipboard or third party software. This API will work with the client server, and the print will happen on the client's side. It does not allow printing from the client screen to the server's printer.
Your program calls this API with the HWND of a panel, (each panel has a field named panel-HWND in its Panel-1 area) and (optionally) the name of a printer. The API will send that panel image to the printer. The image that is sent will be the same size as the image on the screen unless that image would be too big to fit the page, in which case it will be scaled.
If you do not know or do not supply the name of the printer, the API will then ask the user which printer it should use by showing the Windows standard printer selection dialog box. It will feed the users selection back to your program, so that subsequent screen prints will go to the same printer unless you re-initialize the printer name field. The File/Print menu item or the Printer Icon in the GUI ScreenIO Panel Editor invokes and demonstrates this API.
The screen print will contain the requested panel as well as any panel on-top of, and contained within the panel you request. So if you have pop-up panels open on top of a base panel, and you request a screen print of the base panel it will contain the pop-up panels as well (providing they overlap the base). If you request a screen print of the pop-up, all you will get is the pop-up. If you request a screen print of the entire desktop (see options below) the entire desktop and all windows will be printed.
Images will appear as close to actual size as possible. If the screen print exceeds the size of the page, it will be scaled to fit the page. Rotation (landscape / portrait) is per the users selection on the printer dialog, or as set by the program.
Note: this API is not automatically tied to the Print Screen Key. You must program for this feature on those panels were you need it.
In Client/Server environments this API normally runs on the Client side, and it can NOT be forced to run on the Server side. Doing so just opens up too many doors for mischief and remote monitoring.
Naturally, when not running under client server, all sources and destinations are local to the current machine, with no programming changes required.
Files available to copy to your system:
COPY WIN32API. COPY PRNSCRN. COPY GSPRTDEF. * * : Typical call SET PRTSCRN-PARMS-INITIALIZE TO TRUE MOVE mypanel-HWND TO PRTSCRN-WINDOW-HWND SET FUNC-PRINTSCREEN TO TRUE CALL 'GSWINAPI' USING WIN32API-PARMS PRTSCRN-PARMS GS-DEVMODE-DATA WIN32API-C WIN32API-D WIN32API-E WIN32API-F. * * IF WIN32API-FAILED * do print-not-possible-or-canceled * ELSE * continue printing report
See the copybook for the fields documented below.
This field is name of the printer to which you want to send the print. If left blank or low values the API will launch the standard Windows Printer Selection Dialog box so the user can choose the printer. This name will be returned to you in this field after the user makes a selection. On subsequent calls, if you do not re-initialize this field, print will be directed to the same printer.
Note that the storage holding the printer name is local to your program, so if you call this API out of several different programs, the API will not have access to the user's printer selection, and will prompt again for the printer name. This may be irritating, so it is advisable to place this API call in a subroutine to which you pass the Hwnd. This will allow that subroutine to retain the printer selection in local storage. You may wish to handle this event in your GS.COB but you will still need to the event to each panel. You can use the mass-change feature for this.
This in the HWND from the panel copybook of the window you wish to print. It can be any panel in your system as well as your Main (container) panel HWND.
This field provides 88s for your selection of what to print. The legal values are:
There are two printer compatibility modes, with 88 names for each. Normally you should use the default: PRTSCRN-COMPAT-DEFAULT. Certain monitor drivers deliver corrupt images in combination with certain printers, in which case you may want to try PRTSCRN-COMPAT-OLDDRIVER option. This is seldom necessary except on older Windows 9x systems printing to late model printers.
Unused as of this writing.
This area is used to specify printer setup information. Usually retrieved from the PringDlg API, it can also be manually set up, or you can let it default to the users selections, and will be returned to you upon completion. Defined Here.
This argument is standard for all CALLs to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.
Used to return the status of a call to GSWINAPI. A value of zero is a failure, any other value indicates success.
Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.
* ------------------------: If function failed,
Error code that was returned by Windows. This is not generally useful unless you have the Windows Platform SDK documentation available to you.
Plain-text error message that describes why the operation failed.
The number of these present varies depending on how many arguments are used by the desired function. These are not used, but must be present because this CALL requires seven arguments.
|© 2000-2006 Norcom, all rights reserved|