home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
dmrxwps1.zip
/
DMrxWPS.doc
< prev
Wrap
Text File
|
1996-08-03
|
11KB
|
337 lines
===========================================================================
Title: DMrxWPS
Author: David MacMahon (davidm@ccnet.com)
Date: August 3, 1996
Copyright: Copyright D. MacMahon, Inc. 1996.
All rights reserved.
===========================================================================
=================
Table of Contents
=================
(0) Terms and Conditions
(1) Introduction
(2) Functions
WpsLoadFuncs
WpsDropFuncs
WpsQueryObject
WpsQueryObjectPath
WpsSetObjectData
(3) Sample - DelTmplt.cmd
(4) Contacting D. MacMahon, Inc.
========================
(0) Terms and Conditions
========================
The copyright notice appearing at the top of this document applies to both
this document ("Document") and the accompanying binary DMrxWPS library
("DLL") described herein. Both Document and DLL (collectively referred to
as "Product") may be freely used and distributed for any noncommercial
purpose. Neither Document nor DLL may be used or distributed in whole or
in part for any commercial purpose without the prior written consent of D.
MacMahon, Inc.
Consent for limited commercial distribution
------------------------------------------
Consent is hereby granted for limited commercial distribution of Product
provided the following conditions are met:
1) Product is distributed unmodified and in its entirety including the
above copyright notice and this Terms and Conditions section.
2) Product is being distributed as part of a collection of software that is
readily available on the Internet.
3) Said collection of software is not distributed in conjunction with any
other commercial offering.
4) No fee is charged for Product and only a nominal fee is charged for the
collection of software as a whole.
Disclaimer of Warranty
----------------------
Product is provided "as is" without any warranties, express or implied,
from D. MacMahon, Inc. In no event will D. MacMahon, Inc. be liable for
any damages whatsoever incurred through the use of Product.
================
(1) Introduction
================
DMrxWPS is a package that consists of three files: DMrxWPS.dll,
DMrxWPS.doc (this file), and DelTmplt.cmd.
DMrxWPS.dll is a REXX library that provides a bridge between REXX scripts
and some of the WPS related OS/2 API functions, referred to as "Win
functions". Its main purpose is to facilitate the installation and the
reinstallation or updating of WPS classes. The current version of
DMrxWPS supports only three Win functions in addition to its own two
"helper functions". One of the Win functions, WinQueryObjectPath, is only
available on Warp or above. Calling its corresponding DMrxWPS function,
WpsQueryObjectPath, will not work on version of OS/2 before Warp.
Many of the Win functions are available in the RexxUtil REXX library.
DMrxWPS is intended to supplement RexxUtil, not replace it. The three Win
functions included in DMrxWPS are WpsQueryObject, WpsQueryObjectPath, and
WpsSetObjectData. The first two functions were chosen because they can be
used together to obtain the path to a WPFileSystem derived template in the
Templates folder without knowing the path of the Templates folder itself.
This path can then be used to manipulate the template using functions
from RexxUtil. The sample script DelTmplt.cmd (included with DMrxWPS and
described in section 3) shows how this can be done.
DMrxWPS.dll needs to be in one of the directories is specified in the
LIBPATH statement of CONFIG.SYS.
============
2) Functions
============
This section documents the functions provided in DMrxWPS.
-------------
WpsLoadFuncs
-------------
Description:
This function registers all the DMrxWPS functions, except itself, with
REXX. If the name of any previously registered function conflicts with the
name of any function that this routine registers, the previously existing
function is dropped.
Parameters:
None.
Result:
Copyright and version string
Example:
/* WpsLoadFuncs example */
rc = rxFuncAdd( 'WpsLoadFuncs', 'DMrxWPS', 'WpsLoadFuncs');
rc = WpsLoadFuncs(); say rc;
/* All DMrxWPS functions now available */
exit;
This script produces the following output:
DMrxWPS - Version 1.0
Copyright D. MacMahon, Inc. 1996. All rights reserved.
------------
WpsDropFuncs
------------
Description:
This function deregisters all the DMrxWPS functions with REXX. CAUTION:
Deregistering the functions in any ONE session will make the functions
unavailable in ALL sessions.
Parameters:
None.
Result:
Empty string
Example:
/* WpsDropFuncs example */
rc = rxFuncAdd( 'WpsLoadFuncs', 'DMrxWPS', 'WpsLoadFuncs');
rc = WpsLoadFuncs(); say rc;
/* All DMrxWPS functions now available to all REXX sessions*/
rc = WpsDropFuncs();
/* All DMrxWPS functions now unavailable to all REXX sessions*/
exit;
This script produces no output.
--------------
WpsQueryObject
--------------
Description:
This function provides a REXX wrapper to the WinQueryObject function.
Parameter 1:
Object ID of any type of object or the path of any WPFileSystem-derived
object.
Result:
Return value from WinQueryObject. This is the object handle of the queried
object as an eight digit hexadecimal number preceded by '0x'. If
'0x00000000' is returned, there was an error; probably the specified object
does not exist or a path was used in an attempt to get the object ID of an
abstract object.
Example:
/* WpsQueryObject example */
rc = rxFuncAdd( 'WpsLoadFuncs', 'DMrxWPS', 'WpsLoadFuncs');
rc = WpsLoadFuncs(); say rc;
/* All DMrxWPS functions now available to all REXX sessions*/
/* Get handle of <WP_DESKTOP> */
hDesktop = WpsQueryObject( '<WP_DESKTOP>');
/* Print handle of <WP_DESKTOP> */
say '<WP_DESKTOP> is object' hDesktop;
exit;
This script produces the following output:
DMrxWPS - Version 1.0
Copyright D. MacMahon, Inc. 1996. All rights reserved.
<WP_DESKTOP> is object 0x00032AC5
------------------
WpsQueryObjectPath
------------------
Description:
This function provides a REXX wrapper to the WinQueryObjectPath function.
This function is only available on OS/2 version 3 (Warp) or above.
Parameter 1:
Object handle of queried object
Parameter 2:
REXX variable in which to store path
Result:
Return value from WinQueryObjectPath. Nonzero indicates successful
completion. Zero indicates that an error occurred.
Example:
/* WpsQueryObjectPath example */
rc = rxFuncAdd( 'WpsLoadFuncs', 'DMrxWPS', 'WpsLoadFuncs');
rc = WpsLoadFuncs(); say rc;
/* All DMrxWPS functions now available to all REXX sessions*/
/* Get handle of <WP_DESKTOP> */
hDesktop = WpsQueryObject( '<WP_DESKTOP>');
/* Check for error */
if hDesktop == '0x00000000' then
do
/* Uh, oh, display error message and bail out. */
say 'Error retrieving handle of <WP_DESKTOP>';
exit;
end;
/* Get path to <WP_DESKTOP> */
rc = WinQueryObjectPath( hDesktop, DesktopPath);
/* Check for error */
if rc == 0 then
do
/* Uh, oh, display error message and bail out. */
say 'Error retrieving path to object' hDesktop;
exit;
end;
else /* no error */
do
/* Print path */
say 'Path to object' hDesktop 'is' DesktopPath;
end;
exit;
This script produces the following output:
DMrxWPS - Version 1.0
Copyright D. MacMahon, Inc. 1996. All rights reserved.
Path to object 0x00032AC5 is D:\Desktop
----------------
WpsSetObjectData
----------------
Description:
This function provides a REXX wrapper to the WinSetObjectData function.
WpsSetObjectData is similar to, but more versatile than the
SysSetObjectData function found in RexxUtil. SysSetObjectData allows an
object's "restriction options" (e.g. NOTVISIBLE, NOPRINT, etc.) to be
turned on, but does not allow them to be turned off again without
recreating the entire object. WpsSetObjectData allows these restriction
options to be turned both on and off. The first parameter to
WpsSetObjectData should be an object handle instead of an object ID or
path (as SysSetObjectData expects).
Parameter 1:
Object handle of object whose data is being set
Parameter 2:
Setup string
Result:
Return value from WinSetObjectData. Non-zero indicates successful
completion. Zero indicates that an error occurred.
Example:
/* WpsSetObjectData example */
rc = rxFuncAdd( 'WpsLoadFuncs', 'DMrxWPS', 'WpsLoadFuncs');
rc = WpsLoadFuncs(); say rc;
/* All DMrxWPS functions now available to all REXX sessions*/
/* Make "OS/2 System" folder invisible */
rc = WpsSetObjectData( '<WP_OS2SYS>', 'NOTVISIBLE=YES');
/* Check for error */
if rc == 0 then
do
/* Uh, oh, display error message and bail out. */
say 'Error making "OS/2 System" folder invisible';
exit;
end;
/* "OS/2 System" folder is now invisible */
/* Make "OS/2 System" folder visible again */
rc = WpsSetObjectData( '<WP_OS2SYS>', 'NOTVISIBLE=NO');
/* Check for error */
if rc == 0 then
do
/* Uh, oh, display error message and bail out. */
say 'Error making "OS/2 System" folder visible';
exit;
end;
exit;
This script produces no textual output.
=========================
(3) Sample - DelTmplt.cmd
=========================
DelTmplt.cmd is a script file that is used to delete templates. It takes a
single template name as an argument and deletes it. The script is well
commented and should be self-documenting. This script will only delete
templates of classes that are derived (directly or indirectly) from
WPFileSystem. It will not delete templates of classes that are derived
(directly or indirectly) from WPAbstract. Furthermore, templates deleted
from the Templates folder will be recreated automatically whenever the
Templates folder is opened or refreshed. To permanently delete a template
from the Templates folder, deregister the template's class after deleting
the template. A WPS class DLL can be overwritten or deleted once the all
the objects of all the DLL's classes have been deleted, including all
templates of those classes, and the DLL's classes have been deregistered.
================================
(4) Contacting D. MacMahon, Inc.
================================
D. MacMahon, Inc. is a software development firm applying object-oriented,
client/server technologies in heterogeneous environments.
D. MacMahon, Inc. may be reached by sending e-mail to its president,
David MacMahon, at davidm@ccnet.com.