This license permits you to use the software (GPLIB) under the terms of this license. Ownership of the software including the programs, documentation, and any other materials provided with the program, and any components thereof ("LICENSED SOFTWARE") remains with MH Software ("LICENSOR").
The LICENSED SOFTWARE is owned by LICENSOR, is protected by a registered copyright belonging to LICENSOR and is protected by United States copyright laws and international copyright treaty provisions.
You may install GPLIB on one computer or network file server for software development purposes. If you wish to use GPLIB for development on more than one computer or server, you must purchase additional licenses or obtain a site license.
You may distribute GPLIB as part of your software, provided you do so within the following
conditions:
GPLIB.PLB may only be distributed as part of a compiled FoxPro .APP file or FoxPro .EXE file.
GPLIB.FLL may be distributed separately with your .APP or .EXE file. If you deliver source-code to your customer, and your customer, or his agent will make modifications to customers program, then the customer must purchase GPLIB. You may distribute the unregistered version of GPLIB provided that all accompanying documentation and files are included. If your program uses GPLIB, and you wish to distribute it with your source code, without requiring your customers to register GPLIB, then you must purchase a distribution license.
You may not reverse engineer, decompile, or disassemble the software. You may not copy (except for backup purposes), sell or otherwise distribute (except within the terms described above) this software.
You may not share, post on any bulletin board system, or otherwise distribute your GPLIB activation key.
Limits of Liability
LICENSOR makes no warranty of any kind, expressed or implied, with regard to the program or documentation contained in this product. EXCEPT AS EXPRESSLY SET FORTH HEREIN, LICENSOR DISCLAIMS ANY AND ALL PROMISES, REPRESENTATIONS, AND WARRANTIES WITH RESPECT TO THE LICENSED SOFTWARE, INCLUDING THE CONDITION, THE CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, THE EXISTENCE OF ANY ERRORS OR OTHER LATENT OR PATENT DEFECT, ANY INFRINGEMENT OF ANYONE ELSE'S INTELLECTUAL PROPERTY RIGHTS, ANY NEGLIGENCE, THE MERCHANTABILITY OF THE LICENSED SOFTWARE, AND FITNESS FOR ANY PARTICULAR USE. LICENSOR SHALL NOT BE LIABLE IN ANY EVENT FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER LOSS) IN CONNECTION WITH OR ARISING OUT OF THE USE OF THIS PROGRAM. UNDER NO CIRCUMSTANCES SHALL LICESNOR'S LIABILITY EXCEED THE COST PAID FOR THE SOFTWARE, EVEN IF LICENSOR HAS BEEN ADVISED OF THIS POSSIBILITY.
This agreement shall be construed and enforced in accordance with the laws of the State of Colorado. Any action or proceeding brought by either party against the other arising out of or related to the Agreement shall be brought only in a State or Federal Court of competent jurisdiction located in the City and County of Denver, Colorado. The parties hereto agree to in personam jurisdiction of said courts. You agree that should you breach this agreement, said breach will cause imminent harm to LICENSOR and that LICENSOR has no adequate remedy at law, and that injunctive relief is appropriate. You also agree that if you should breach this agreement, LICENSOR shall be entitled to reasonable costs including attorneys' fees in any action to enforce any provision of the agreement. This agreement is the full integration of the understanding between the parties thereto.
Defective Media
If within ninety (90) days of receipt of this software, the distribution media is found to be defective, you may receive replacement media for no charge. After 90 days there will be a nominal shipping and handling fee.
Customer Remedies
LICENSOR'S entire liability and your exclusive remedy shall be, at LICENSOR'S option, either (a) return of the price paid for the software, or (b) repair or replacement of defective media.
Trademarks
FoxPro and MSDOS are registered trademarks and Windows is a trademark of Microsoft Corporation. NetWare is a registered trademark of Novell, Inc. GPLIB is a trademark of LICENSOR.
Shareware
GPLIB is shareware. This means that you may test this software to determine if it fits your needs. If you find it is useful to you, you must register this software by filling out the enclosed registration form and returning it with your payment. If you find this software is not useful to you, you must remove this software from all computers it is installed on.
───────────────────────────────────
See Also: Registration Information
───────────────────────────────────
License Q&A
Q: I would like to install GPLIB on my network. I have 100 programmers attached to the network who will be accessing GPLIB. How many licenses do I need?
A: You need only purchase one license. The GPLIB license agreement allows it to be installed on one computer or one network server.
Q: I have 20 programmers. Each programmer needs GPLIB installed on their own PC. How many licenses do I need?
A: You need to purchase 20 licenses. The GPLIB license agreement allows it to be installed on one computer or network server. In this case because you wish to install it on 20 computers you need 20 licenses. You can contact MH Software for a quantity pricing schedule.
Q: I am doing some contract work for a client. I have registered GPLIB. After I complete the work, their people will take over maintenance of the software. Can I distribute my copy of GPLIB to them?
A: No. In this case, your client will need to purchase a license to use GPLIB. The license permits you to distribute GPLIB as part of a compiled application. In this case, since the library would be used by a third party for development, they must license the software.
Q: I am selling a FoxPro add-in product. My product would benefit greatly from incorporation of GPLIB. When I distribute my product I will distribute the source code, and would like to include a registered version of GPLIB for use by other developers. If I register GPLIB, may I distribute it with my product?
A: No. The license for GPLIB allows you to distribute it only as part of a compiled application. If you wish to distribute GPLIB you must contact MH Software for a distribution license. You may distribute the unregistered version of GPLIB with your product provided that all accompanying documentation including license, manual, and sample programs are included.
Q: My company is developing a dry-cleaning vertical market application. We estimate sales will be 10,000 units per month. We would like to use GPLIB in our product. The application will only be distributed in compiled form. There will not be any VARs or other intermediaries who will have access to the source code. How many licenses do we need?
A: Most likely you need only one license. The license for GPLIB restricts how many machines it can be installed upon for development purposes. You may distribute an unlimited number of copies of GPLIB as long as it is part of the compiled application.
Registration Information
GPLIB is Shareware. You may test GPLIB, but if you continue to use it, you must register.
Registered users of GPLIB get free updates via CompuServe. When you register, you will be given a serial number and an activation key. You can use this to register the latest version of the software as it is placed on CompuServe. For example: you register GPLIB, two months later, when a new version is released, you can download the new files from CompuServe. You can then register the new program using the Serial Number and Activation Key you were given at registration.
Registered users also receive a bound, printed manual, and a diskette containing the most current version of GPLIB.
Shipping
MAIL
Normal US Shipment is via 2nd Day US Mail. Normal International Shipment is via small-packet air mail. Delivery times to Europe average about 7 days
Federal Express
Shipment via Federal Express is also available. If you desire next day shipment or traceable shipment your order should be sent via Federal Express.
Electronic Notification
If you include your Internet or Compuserve ID with your registration, you will also electronically receive your serial number and activation key.
Purchase Orders
Purchase orders are accepted from US and Canadian companies and foreign subsidiaries of US companies. You may fax your purchase order to (303) 469-9679. Payment terms are Net 30.
Turnaround Time
Generally, all orders are processed the same day they are received. If your order is received by 3:00 MST, you will receive electronic notification that day, and your order within the time specified in the shipping section.
Credit Cards
We accept Visa and Master Card for payment. To order using your Visa or Master Card, please complete the credit card ordering information section.
GPLIB Registration Form
Name: ___________________________ Compuserve ID (Optional) _______________
We welcome your requests for enhancements. MH Software is dedicated to providing the finest FoxPro enhancement tools available. We need your input to let us know how we can improve our products. If you have an idea for an enhancement, please contact us. When you do, please be sure to provide your daytime telephone number in the event that we need to contact you for clarification. Please forward all requests for enhancements to CompuServe mail ID 73237,1665 or mail them to:
MH Software
1006 W 104th Ave #200
Northglenn, CO 80234
───────────────────────────────────
See Also: Upgrades
───────────────────────────────────
Upgrades
With the registration of GPLIB, you are entitled to free same-version updates. This means you are entitled to free updates for versions of GPLIB for FoxPro 2.5 (DOS and Windows). These free updates can be obtained via download from CompuServe. The latest version of GPLIB is available on the Microsoft FoxPro Support Forum (GO FOXFORUM). You can download the latest version from this forum as soon as it is made available. After you download them, use the REGISTER utility program to enter your serial number, activation key and registration information into the library. The registration process will suppress demonstration version messages. If you are unable to download the file from CompuServe, you can obtain an upgrade disk for $10.00. Mail your check or money order to:
MH Software
1006 W 104th Ave #200
Northglenn, CO 80234
───────────────────────────────────
See Also: Registration Program
───────────────────────────────────
Technical Support
Every effort has been made to ensure this software is free of defects. If you find a bug in this program we will make every effort to fix the problem and provide you with an updated program. You may contact technical support via CompuServe mail @73237,1665, via Internet at 73237.1665@compuserve.com, by calling (303) 438-9585, or via mail at:
MH Software
1006 W 104th Ave #200
Northglenn, CO 80234
General Info About GPLIB
GPLIB is a general purpose FoxPro 2.5 API Library. It has several general purpose DOS & PC related functions as well as over 75 NetWare specific commands. In order for the NetWare functions to work you must be using NetWare 2.1X or higher. These functions will not work with NetWare Lite or NetWare Personal Edition.
If you are using FoxPro to view this document you may need to set WORD WRAP on in your Edit/Preferences.
Error Handling and GPLIB
In most instances, I have relied on the FoxPro API _UserError function. The function will generate error 1098, and return a descriptive error text message, rather than having the function return a number that must be interpreted. An example of this is an attempt to map a drive to a file server you are not connected to: N_MapDrive('sys:','G','ENGINEERING'), if you are not attached to server ENGINEERING, FoxPro's Error() function will return 1098, and the message function will return "Not attached to server ENGINEERING". Hopefully, this reduces the amount of error trapping you have to code into your application. In my programming I rely entirely on Pat Adams ProError error handler. If you are not using ProError, I recommend you download it and try it.
NetWare Security and GPLIB
Certain functions require that the person executing be either the network supervisor, or equivalent. An example of this is N_PwdDate(). I can use this function to get my password date, but I cannot use it to get another persons password date UNLESS: 1) I am SUPERVISOR or equivalent, 2) I am security equivalent to that person, 3) I am a manager over that person. This generally applies to N_SecEquiv(), N_PwdDate(), N_AccsDate(), etc., those functions which read the NetWare bindery for specific user information. Also, some functions such as N_LIStat() require that the person executing them be either a supervisor, or a console operator.
Manual Translations
MH Software recognizes that not all FoxPro programmers speak English. At the same time we are constrained to keep costs down to make this product work as shareware. To that end, permission is granted for FoxPro user groups with non-English speaking members to translate and publish this manual. The following restrictions apply. 1) You must notify MH Software that you are beginning a translation effort and the language(s) you are translating to. 2) The manual must be reproduced in it's entirety including the License Agreement, all copyright notices, registration forms, and all sample code. 3) You must notify MH Software when you have completed and published your translation. 4) You grant MH Software permission to list your User Group as a source of a translated manual. 5) You agree to send MH Software three (3) copies of the completed manual, once printed.
What's New Since V2.54
N_DrvDepth()
Function to return relative drive depth for a drive that has a "fake root" mapping.
N_GetLocks()
Function to return the file/records locks applied to a particular file.
N_Login()
Corrected error that wouldn't allow GPLIB to use the 8th slot of the NetWare shell for logins.
N_StPParms()
Added additional error checking to ensure that a queue and server name are passed.
N_LogOff()
Added additional documentation to clarify usage.
What's New Since V2.53
N_CUsing()
Function to return a list of connections that have a specified file open.
N_DrvList()
Function to return list of available drives.
N_TrustLst()
Function to return a list of trustees for a specified file or directory.
N_TrustMod()
Function modify trustee rights to a directory or file.
N_TrustRem()
Function to remove trustee rights from a directory or file.
N_StPParms()
N_StPParms() now implicitly performs N_FlushLPT(). This corrects problems some users were having when using N_StPParms() when there was an active printjob.
Demo Message
Fixed problem that caused the Demonstration version message to appear on the .FLL version on subsequent loads. The problem was caused by Windows not unloading the .FLL file (DLL) between runs.
What's New Since V2.52
Fixed bug where N_RdPParms() & N_StPParms() were not properly handling the formfeed flag, and the AutoEndCap Flag.
Fixed bug in N_Snd2Serv() that could result in occasionally sending extra characters in the message.
Fixed Documentation for N_Login().
What's new since V2.51
The following functions have been renamed or modified:
Old Name New Name
N_Attach() N_ServAtch()
N_Brd2Cons() N_Snd2Serv()
N_BrdFCons() N_SndFServ()
N_Capture() N_CapMode()
N_Cast() N_MsgMode()
N_Date() N_ServDate()
N_Detach() N_ServDtch()
N_DfServer() N_DefServr()
N_Equivs() Syntax change for compatibility with N_GrpMbrs()
N_FlagTran() No longer supported. See N_SetAttr()
N_FullName() N_UserName()
N_GetBMode() N_MsgMode()
N_GetBMsg() N_MsgRtrv()
N_GetMATyp() N_LongMach()
N_GetOSVer() No longer supported.
N_GetOSTyp() No longer supported.
N_GetPath() N_DrvPath()
N_GetPStat() N_RdPParms()
N_GetSMTyp() N_ShrtMach()
N_GroupsIn() Syntax change for compatibility with N_GrpMbrs()
N_IsAttach() N_Attached()
N_IsEquiv() N_SecEquiv()
N_IsLogged() N_LoggedIn()
N_IsMap() No longer supported. See N_ServFrDr()
N_IsMember() N_MemberOf()
N_IsNWBoss() N_ConsOper()
N_LastLog() N_AccsDate()
N_LocDrv() N_DriveCnt()
N_LogDate() N_LogInfo()
N_LoginFS() N_Login()
N_Logout() N_LogOff()
N_LogoutFS() N_LogOff()
N_LogTime() N_LogInfo()
N_Map() N_MapDrive()
N_MapRem() N_MapDel()
N_MapRoot() Syntax change for compatibility with N_MapDrive()
N_Members() N_GrpMbrs()
N_NoLogin() N_LIStat()
N_NWVers() N_ServVers()
N_OkLogin() N_LIStat()
N_PJobList() N_LstQJobs()
N_PJobMove() N_MoveQJob()
N_PJobRem() N_DelQJob()
N_Semaphor() N_SetSem()
N_SendMsg() N_MsgBrd()
N_ServerID() No Longer Supported. See N_Servers()
N_ServFrID() No longer supported. See N_Servers()
N_ServName() N_ServFrDr()
N_SetPStat() N_StPParms()
N_StaID() N_ConnNum()
N_Time() N_ServTime()
N_TTSEnd() N_TTSCommt()
N_TTSZap() N_TTSRollB()
N_FileInfo()
Function to read extended NetWare attributes of a file.
N_SetAttr()
Function to set extended NetWare attributes of a file.
IsDiskIn()
Function now returns .T. if a fixed disk is specified.
N_CapMode()
Supports new parameter to discard current print job.
N_RdPParms()
Supports setting and clearing AutoEndCap flag.
How To Access GPLIB
To use the commands in GPLIB you must first issue the command:
SET LIBRARY TO GPLIB
This loads the library and allows FoxPro to access the functions contained inside it. For information on how to use each individual function, please refer to the documentation following this page. Once the SET LIBRARY TO GPLIB command has been issued, you can see a list of all the GPLIB functions by typing DISPLAY STATUS. For some additional information on SET LIBRARY TO, refer to the FoxPro help file for SET LIBRARY.
To make GPLIB, and GPHELP more readily available to FoxPro, you may want to add a statement to your CONFIG.FP that sets a path to the directory containing them, i.e.:
PATH = C:\FOXPRO25\API
You could then access GPLIB by typing SET LIBRARY TO GPLIB without specifying the full path. Similarly, you could SET HELP TO GPHELP without specifying the full path.
About MakeHelp.PRG
The MakeHelp program included with GPLIB will convert this document into a FoxPro 2.5 compatible help file. This allows you to use the FoxPro Help system to access information about the commands stored in GPLIB.
To create the Help database, from the command window type DO MAKEHELP. The program will then create the database.
In later sessions, to access the GPLIB help database you can issue the command SET HELP TO GPHELP. When the FoxPro HELP function is invoked by pressing F1, or typing help, the GPLIB information will be available.
To restore the HELP function to the standard FoxPro Help file, issue the command:
SET HELP TO
Registration Program
GPLIB comes with a registration program named REGISTER.EXE. This program is used to embed the registration information into GPLIB. Once this program is ran, the demonstration version message will stop being displayed.
To use the program, from the DOS Prompt type:
REGISTER GPLIB.PLB GPLIB.FLL
You will be prompted to enter your serial number and activation key. Once these are entered, you will be prompted to enter your registration information. This information will be embedded in the library. Once embedded, it can be displayed using ABOUTGPLIB().
Function List for GPLIB
This section contains a list of all the functions that are contained in GPLIB. For specific information on how to use each command, refer to the documentation for that specific command.
AboutGPLIB() - Return version information for GPLIB
AMPM() - Function to return time as character string with AM or PM appended.
ColdBoot() - Coldboot a computer.
CtlAltShft() - Return true if Control, Alt, or Shift key is held down
ElapseTime() - Function to return difference in minutes between two time strings.
FileCount() - Function to return # of matching files in a directory.
FindFirst() - Function to perform a DOS find first/find next.
Flag() - Set DOS file attributes.
GenError() - Function to generate a FoxPro error.
IsDiskIn() - Function to return whether a disk is in the floppy drive specified.
Make_Dir() - Create directory.
Math_Chip() - Return true if a 80x87 math coprocessor is installed.
MReset() - Perform mouse reset & return number of buttons.
Num_Serial() - Return Number of Serial Ports
N_AccsDate() - Return last login date & time for a user.
N_AcctList() - Return list of user accounts from server.
N_Attached() - Return whether attached to a server.
N_CapMode() - Toggle capture on or off.
N_ChgPwd() - Change Bindery Object Password
N_ChkOwner() - Check/Set ownership of specified files.
N_ClearSta() - Clear Specified Connection Number
N_ConnNum() - Return NetWare station number.
N_ConsOper() - Return whether workstation is a console operator
N_CUsing() - Return list of stations using a specified file.
N_DefServr() - Change default server.
N_DelQJob() - Function to remove a print job from a queue.
N_DirInfo() - Return directory owner and rights mask.
N_DriveCnt() - Return number of logical local drives.
N_DrvDepth() - Return relative drive depth for "fake root" drives.
N_DrvList() - Return list of available drives.
N_DrvPath() - Return Path for a drive letter.
N_Equivs() - Return list of objects the specified user is equivalent to.
N_FlushLPT() - Flush capture of specified LPT port.
N_GetGroup() - Return list of groups from server.
N_GetLocks() - Return list of record/file locks for a file.
N_GetQList() - Return List of Queues from server.
N_GetSList() - Return List of Servers from the file server.
N_GetWild() - Get List Of all bindery objects from server.
N_GroupsIn() - Returns list of groups a specified user is in.
N_GrpMbrs() - Return list of members for specified group.
N_LIStat() - Read/Set the login state of the server
N_LoggedIn() - Return whether specified user is logged into the network.
N_Login() - Login to a file server.
N_LogInfo() - Return Login date or time for a station.
N_LogOff() - Logout of specified file server.
N_LongMach() - Get Long Machine Type
N_LstQJobs() - Function to create an array containing print jobs for the specified queue.
N_MapDel() - Delete A drive mapping
N_MapDrive() - Map a drive
N_MapRoot() - Map root command.
N_MaxConns() - Return Maximum NetWare connections.
N_MemberOf() - Return Group Membership
N_MoveQJob() - Function to move print job within a print queue.
N_MsgBrd() - Send a message to another network user.
N_MsgMode() - Return current station broadcast mode.
N_MsgRtrv() - Retrieve a stored message from the file server.
N_PwdDate() - Return date users password expires.
N_RdPParms() - Get current Capture Settings
N_SecEquiv() - Return Security Equivalence
N_SerialNo() - Return server NetWare serial number.
N_ServAtch() - Attach to a file server.
N_ServDate() - Return File Server Date
N_ServDtch() - Detach from file server
N_Servers() - Create list of servers currently logged into.
N_ServFrDr() - Return file server name for a mapped drive
N_ServTime() - Return File Server Time
N_ServVers() - Return NetWare version number.
N_SetAttr() - Set extended attributes on a NetWare file.
N_SetDots() - Set SHOW DOTS on or off, or return current value.
N_SetSem() - Perform Network semaphore locking.
N_ShellVer() - Return Shell Version
N_ShrtMach() - Get Short Machine Type
N_Snd2Serv() - Broadcast message to server console.
N_SndFServ() - Broadcast message from server console.
N_StaAddr() - Return Physical station Address
N_StPParms() - Modify Current capture settings.
N_SYSTime() - Synchronize stations clock to server.
N_TrustLst() - Return trustee list for a file or directory.
N_TrustMod() - Modify Trustee rights to file or directory.
N_TrustRem() - Remove trustee rights to a file or directory.
N_TTSAvail() - Return / Set TTS Availability
N_TTSBegin() - Begin a TTS Transaction
N_TTSCommt() - End a TTS Transaction
N_TTSRollB() - Rollback a TTS Transaction
N_TTSStat() - Return status of a completed transaction
N_TTSStat() - Return status of a completed transaction
N_TTSRollB() - Rollback a TTS Transaction
───────────────────────────────────
See Also: N_SetSem(), N_TTSAvail(), N_TTSBegin(), N_TTSCommt(), N_TTSRollB(), N_TTSStat()
───────────────────────────────────
Additional Sample Procs.
GPLIB is accompanied by many additional programs that demonstrate how GPLIB can be used. Below is a short description of each program.
DosToNet.PRG A simple function to convert a DOS file spec to the equivalent NetWare Volume:<Path>\<FileSpec> format.
QMgr.PRG A simple queue manager program demonstrating how to use N_LstQJobs(), N_MoveQJob() and N_DelQJob().
SetPJob.PRG This program demonstrates how to read the Novell PrintCon job database, and use the information in it to setup capture parameters.
SetQueue.SCX This screen implements a simple queue selection.
GPDEMO.PJX This project contains several routines that demonstrate how to use various GPLIB functions. To execute this demo, execute the following commands from the FoxPro command window:
AboutGPLIB() - Return version information for GPLIB
Description
This function displays the current version number of GPLIB, and the compile date in a WAIT WINDOW. If the version of GPLIB is registered, a second WAIT WINDOW will appear showing the registered owner's name and your GPLIB serial number.
Usage
AboutGPLIB( [NoDisplay] )
If the optional parameter of NoDisplay is passed, then the wait window will not be shown.
AMPM() - Return time string with AM or PM appended.
Description
Return time string in standard form with AM or PM appended.
Usage
AMPM([ nSeconds ] )
nSeconds is the optional number of seconds after midnight. If this value is not passed, the function returns the current time. If you pass a seconds value, then that time in seconds past midnight is converted to a standard AM/PM time string.
Return Values
Time string with AM or PM appended.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?AMPM()
1:47 PM
?'The report must be filled out and returned to this office by '
??AMPM(Seconds()+3*60*60) && Current time in seconds + 3 hours * 60 minutes * 60 seconds to yield a time three hours from the current time.
This function is only available for FoxPro for DOS. Calls to this function from FoxPro for Windows will be ignored.
WARNING
YOU AS A DEVELOPER TAKE FULL RESPONSIBILITY FOR THE CONSEQUENCES OF THIS FUNCTION. COLD-BOOTING PCs WITH CERTAIN CACHE AND COMPRESSION SOFTWARE ACTIVE MAY CAUSE THE HARD DRIVE PARTITION ON THAT COMPUTER TO BE UNREADABLE.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?"In order for changes made to your computer's configuration"
?"to take effect, it is necessary to reboot your computer."
ElapseTime() - Return the difference in minutes between two time strings.
Description
Return the difference in minutes between two time strings.
Usage
ElapseTime( cTimeStart, cTimeStop )
cTimeStart and cTimeStop are character strings that contain the start time and the stop time. The character strings must be in the standard format for time strings. I.E. '21:30:34'.
Return Values
Number corresponding to the difference between the two times.
Comments
Input resolution is only supported to the second. If cTimeStart is less than cTimeStop, it is assumed that midnight has passed.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
&& Capture information about the start & end of event.
Replace TimeStart with Time()
&& Event
Replace TimeEnd with Time()
* Show those cases that took longer than 15 minutes.
FindFirst() - Function to perform a DOS find-first /find-next
Description
Perform a DOS find first / find next, and return file information.
Usage
FindFirst( cFileSpec | 1 [, cAttribs ] )
cFileSpec is the file specification to search for. You must start your series of calls with a character FileSpec. Subsequent calls (FindNext) are signalled by passing a 1 as the first parameter.
cAttribs is an optional attribute specifier that allows Directory and volume names to be searched for as well. Valid values are 'D', and 'V'
Return Values
If the command was successful it returns a string in the format:
This command is intended to be a replacement for the SYS(2000) command. Computers running the standard version of FoxPro cannot use the ADIR() function when there are more than 720 files present. Using ADIR() on individual files is unacceptably slow. This function allows you to overcome these limitations.
If you specify 'D' as the second parameter to include, all normal files, archive files, and read-only files are returned as well as directories. This is a function of MSDOS. If you specify 'V', only the volume name is returned.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* This program builds a cursor containing files in the current
* directory, then performs a browse.
set library to gplib
private FName, StartTime
create cursor DirList (FileName c(12), Bytes n(9), date d(8), time c(8), Attribs c(5))
FName=findfirst('*.*','D')
StartTime=seconds()
do while len(FName)>0
append blank
replace FileName with left(FName,at(',',FName)-1),;
bytes with val(substr(FName,at(',',FName)+1,at(',',FName,2))),;
date with ctod(substr(FName,at(',',FName,2)+1,at(',',FName,3))),;
time with substr(FName,at(',',FName,3)+1,at(',',FName,4) ),;
cFileSpec is the name of the file to change. Standard DOS wildcards of '?' and '*' are supported.
cAttributeFlags is the attributes to change. Supported attribute flags are:
R - Read Only
H - Hidden
S - System
A - Archive
flags are in the format +<attribute>, to set that attribute bit, or -<attribute> to clear that attribute bit. Spaces are not permitted between the bit operator, and bit name.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
=Flag('*.PRG','+R') && Set all prg files in current directory read-only
Generate a FoxPro error. This error will be handled by whatever the current ON ERROR handler is. When the function is called, the FoxPro ERROR() function returns 1098 (User defined error), and the message specified is returned by MESSAGE()
Usage
GenError( cCustomMessage )
cCustomMessage is the character string that the MESSAGE() function returns when the error is generated. The length of the message may be up to 80 characters.
Comments
I use ProError by Pat Adams extensively in my programs, and I have had times when I wished to generate an error so that the information would be captured by ProError. An example of such a case is shown below. Some other areas might be when a password is incorrectly entered, you could log the error into the ProError database for later examination.
IsDiskIn() - Return whether disk is in the specified floppy drive.
Description
Return whether disk is in the specified floppy drive.
Usage
IsDiskIn( cDriveLetter )
cDriveLetter is the drive to check (e.g. 'A')
Return Values
.T. if diskette is inserted in specified drive. .F. if not inserted. Note the diskette inserted in the drive must be formatted for this function to return .T. If a fixed disk is specified, the function will return .T.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
If IsDiskIn('A')
Wait Window 'Purging last months data to floppy disk.' nowait
The purpose of this routine is to create a DOS directory.
Usage
MAKE_DIR( cDirName )
cDirName is the name of the directory to create
Return Values
.T. if successful, .F. otherwise
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
if .not. make_dir('C:\MyProg\Temp')
?'Unable to create directory'
else
?'Directory created'
endif
Comments
This routine will only create 1 directory level. I.E. in order to create C:\TEMP\TEMP1, the directory C:\TEMP must exist before the TEMP1 directory can be created. One thing that can cause this routine to fail is the presence of a file with the same name as the directory you are trying to create. I.E. if file TEMP exists, creating a directory name TEMP will fail. This is because they are both directory entries on this disk, with only the attribute bit specifying one is a directory.
N_AccsDate() - Return date or time user last accessed the network.
Description
Return the date or time the specified user last accessed the network.
Usage
N_AccsDate( cUserID , 1 || 2 )
cUserID user ID to get the last network access time for.
If the second parameter is 1, the last login date will be returned as a variable of type date.
If the second parameter is 2, the last login time will be returned in seconds past midnight.
Return Values
Last network access date, or time depending on the second paramter.
Comments
To use this routine to get the last login date for any person besides the person operating the program, you must be a supervisor equivalent, equivalent to that user, or manager over that user.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_AccsDate(N_UserID(), 1)
02/27/92
?N_AccsDate(N_UserID(), 2)
9345
* This example demonstrates a house cleaning routine that will put
* an entry in the system error log when accounts are inactive.
* You must be a supervisor or equivalent for this program to work.
cArrayName is the name of the array that will be created to hold the information returned.
cAcctSpec is an option specifier that limits the names of the accounts returned.
cServerName is an optional server identifier. You can specify a different server to get the account list from (besides the default server).
If a .T. is passed as the fourth parameter, the array created will be public.
Return Values
The number of user accounts on the server, and a two dimensional array where column 1 is the Login ID's, and column 2 is the NetWare Object ID assigned to that user.
Comments
The NetWare ObjectID is the same as the users mail ID.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* The following example builds an array of all users on the
Toggle the current capture state ON or OFF, or return the current capture state.
Usage
N_CapMode( iLptPort [, lState , lDiscardJob ])
iLptPort is the LPT port to set the capture state, or get the capture state for.
lState is the flag used to set the capture state. Allowed values are .T. or .F.
lDiscardJob is an optional flag used in conjunction with lState. If lState is .F. and lDiscardJob is true, then capture will be ended, and the current printjob discarded. If lState is .F. and lDiscardJob is not passed, or is .F. then the job will be serviced normally.
Return Values
If called in interrogate mode ( lState not passed ), the function returns .T. if capture is active, and .F. if capture is not active. In set mode (lState is specified) the function returns .T. if successful, .F. if not successful.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
external array P_Array
=N_RdPParms(1,'P_Array')
P_Array[2]='MYQUEUE'
=N_StPParms(1,'P_Array')
* Perform output & reports
* and then
* Send output to local printer
=N_CapMode(1,.F.)
* Turn the net printer back on
=N_CapMode(1,.T.)
!capture nb nt q=printq_0
?N_CapMode(1)
.T.
───────────────────────────────────
See Also: N_FlushLpt(), N_RdPParms(), N_StPParms()
cObjectID is the name of the object to change the password for.
cOldPassword is the current password for the object. If the person using this routine is a supervisor equivalent, then a null string may be passed. This allows you to change the passwords for all users programatically.
cNewPassword is the new password for the object.
nObjectType is the type of object to change the password for. If this optional parameter is not passed, the default object type is 1 (user). Some object types are:
User 1
Job Server 5
Print Server 7
Archive Server 9
Return Values
0 Success
215 Password Not Unique
216 Password too short
248 No Property Write Privilege
255 No Such Object Or Bad Password
Comments
This function does no validation to ensure that a password is valid. It is recommended that you use the sample validation routine provided.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
*
* Change the current users password
*
store space(127) to cOldPass, cNewPass
clear
@5,5 Say 'Enter Old Password : ' Get cOldPass Picture '@S40'
@7,5 Say 'Enter New Password : ' Get cNewPass Picture '@S40'
N_ChkOwner() - Check/Set Ownership of Specified Files
Description
The purpose of this function is to check/set the ownership of a specified file, or files.
Usage
N_ChkOwner( cFileSpec [, cUserName, lOverRide] )
cFileSpec is the file specification to check ownership for. It may contain the DOS wildcard characters * and ?. cFileSpec must be in the form <Volume>:<Path>\FileSpec.Ext.
cUserName is the optional new user to assign unowned files to.
lOverRide is an override that allows you to assign all files matching cFileSpec to cUserName, regardless of whether the current owner is valid or not. If lOverRide is .t., files will be changed regardless of whether they have a valid owner. If .f., they will only be changed if the owner is invalid.
Return Values
If only cFileSpec is passed, the function returns .T. if all files have a valid owner, and .F. if they do not.
If cUserName is passed, then the function returns .t. if the change was made to the new owner, and .f. otherwise.
Comments
Under NetWare, if the owner of a file is deleted and an attempt is made to increase the size of the file, the command will fail. FoxPro will return an error INSUFFICIENT DISK SPACE. The technical reason this fails is because on the call to increase the file size, NetWare makes a call to GetObjectDiskRestrictions(). The call to GetObjectDiskRestrictions fails because the user no longer exists. NetWare treats the failure of this call as NO_DISKSPACE_REMAINING. Using this function you can check for this conditition before it causes an error.
This error will not necessarily come on the first call to append, but rather when the file size increases to the point where NetWare needs to allocate another block to the file.
You must be a supervisor equivalent or have SUPERVISORY rights over the directory in which the file resides to use the owner re-assignment option.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
if not N_ChkOwner('sys:foxdata\*.dbf') && Check to see if the files are ok
*
* we have some bad files, let's try to assign ownership
* to the person currently executing the program
*
if not N_ChkOwner('sys:foxdata\*.dbf',N_UserID())
=msgwin('Some files required by this program do not have a valid owner'+;
' please contact your network administrator and ask him to '+;
The purpose of this function is to clear the specified network station number.
Usage
N_ClearSta( iStationNumber )
iStationNumber is the station number to clear.
Comments
You must be a supervisor equivalent to execute this command.
WARNING
DO NOT CLEAR YOUR OWN STATION AS A TEST! Under certain versions of NetWare, this can cause the server to not recognize your connection until the connection has been manually deleted at the server. This can have the effect of making your network interface card appear defective. If you have to manually delete your connection at the server and you are running NetWare 3.10, ensure that you have the latest version of monitor.nlm, otherwise clearing that connection may cause an ABEND on your server.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* Clear all users logged in as GUEST prior
* to packing DBF. NOTE: THE RESULTS OF CLEARING A CONNECTION WITH
* READ/WRITE PRIVELIGES TO AN OPEN DBF ARE UNDEFINED, AND YOU
* AS PROGRAMMER ACCEPT FULL RESPONSIBILITY FOR YOUR ACTIONS.
Return the NetWare connection number for the current machine. Each time a station logs into a NetWare file server, it is issued a connection number. This number will vary from 1 to the number corresponding to your NetWare License limit.
N_ConsOper() - Return whether person is console operator.
Description
Return whether the person on the executing workstation is a NetWare Console Operator. A person must be a console operator before performing certain functions (enabling or disabling TTS, sending messages from the server console, etc.
Usage
N_ConsOper()
Return Values
.T. if person is a console operator, .F. otherwise.
cFileName is the name of the file to check. cFileName must be in the format <VOLUME>:<PATH>\<NAME>. I.E. SYS:PUBLIC\SYSCON.EXE.
cServer is the optional server name where the file resides.
lPublic is an optional parameter that governs whether the array is created PUBLIC or PRIVATE. If .T. the array will be public. If .F. or not passed, the array will be private.
Return Values
The number of stations/tasks that have the specified file open. The function creates a two-column array containing a list of stations/tasks that have the specified file open. Column 1 is the station number, and column 2 is the task number.
If an error occurs, the function returns the NetWare error code as a negative number. Error codes are:
-152 Volume Does Not Exist
-156 Invalid File Name
-198 Not A Console Operator
Comments
The user on the executing workstation must be a NetWare Console Operator in order to call this function. For more information on Console Operator status, please refer to your NetWare Concepts Manual. One method of getting around the console operator requirement is to dedicate one program to receiving requests via shared DBF and passing results via shared DBF.
With the advent of Microsoft Windows and other multi-tasking environments, more than one "task" on a work-station can have file open on one station.
This function only works on NetWare 3.11 and higher.
N_DefServr() - Read/Set the name of the default server
Description
Read/Set the name of the default server
Usage
N_DefServr( [cServerName] )
If the optional parameter cServerName is not passed, the function returns the name of the current default server. If cServerName is passed, then that server is made the new default server.
Return Values
Name of the default server.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* Display a list of users currently logged in, and their full names
This function returns the relative drive depth for a specified drive. It can be used to determine if a drive was mapped using the MAP ROOT option.
Usage
N_DrvDepth( cDrive )
cDrive is the drive letter to check.
Return Values
Relative drive depth for specified drive. If drive is not mapped with the ROOT option, then this function returns 255. If the specified drive is not mapped, the function returns 255.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
=N_MapRoot('SYS:USERS','G')
?N_DrvDepth('G')
0
SET DEFA TO G:
SET DEFA TO (N_USERID())
?N_DrvDepth('G')
1
?N_MapDrive('SYS:USERS','G') && Note not a "fake root"
?N_DrvDepth('G')
255
───────────────────────────────────
See Also: N_DrvPath(), N_MapDel(), N_MapRoot(), N_ServFrDr()
This function returns a list of available drives on the workstation.
Usage
N_DrvList( cArrayName, [ iMask, lPublic ] )
cArrayName is the name of the array to create.
iMask is the optional drive mask to limit the types of drives returned. If this parameter is not included, all drives are returned. Allowed values are:
0 All Drives
1 Local Drives Only (Fixed and Removable)
2 Remote Drives Only (Fixed and Removable)
4 Removable Drives Only (Local and Remote)
5 Local Removable Drives Only
6 Remote Removable Drives Only
8 Fixed Drives Only (Local and Remote)
9 Local Fixed Drives Only
10 Remote Fixed Drives Only
lPublic is an optional parameter that specifies if the array should be created as a public variable. If .T., the array will be public, if .F. the array will be private.
Return Values
The function returns the number of drives matching the desired drive-type. The function creates a two-dimensional, three-column array containing information about the drives on the calling workstation.
Column 1 is the drive letter
Column 2 is .T. if the drive is remote, .F. if local.
Column 3 is .T. if the drive is removable, .F. if Fixed.
Comments
This function uses standard DOS interrupt calls to make it's list. Therefore, this function will work with any NOS (Banyan Vines, LanMan, NetWare, etc).
cDriveLetter is the drive letter to return the path for.
Return Values
The NetWare path of the drive letter as a character string. The path will be in the format <Volume>:<PATH>. If the drive is not mapped, the function returns a null string.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
=N_MapDrive('sys:public','G')
?N_DrvPath('g')
SYS:PUBLIC
───────────────────────────────────
See Also: N_DriveCnt(), N_MapDel(), N_MapDrive(), N_ServFrDr()
N_Equivs() - Return all objects a specifed user is equivalent to
Description
This function creates an array containing a list of objects the specified user is equivalent to.
Usage
N_Equivs( cUserID, cArrayName [, .T. ])
cUserID is the user ID to get equivalent listings for. cUserID may not contain wild-cards.
cArrayName is the name of the array to create.
If the optional third parameter of .T. is passed, then the array created will be public.
Return Values
Number of objects the user is equivalent to. Creates an array containing the names of objects the user is equivalent to. These objects can include user groups, or other users.
N_FileInfo() - Return information about a file or files.
Description
This function returns the NetWare specific information about a particular file or files. This function is implemented as a find-first/find-next system.
Usage
N_FileInfo( cFileSpec [, 1] )
cFileSpec is the file specification to return information about. The path should be in the format <VOLUME>:<PATH>\<FILESPEC>.
1 is the optional second parameter to be used on the second and subsequent calls to this function.
Return Values
The function returns information about the file in a comma-delimited list. The format is:
This function is implemented as a find-first/find-next function because of the limitations of FoxPro. Because the standard version of FoxPro can only have arrays with 3600 elements, if this function created an array it would fail on any directory having more than 300 files.
The purpose of this function is to flush the specified LPT port. This releases any job that is currently captured to that port to the network for processing.
Usage
N_FlushLPT( [ iPortNumber ] )
iPortNumber is the LPT port to flush. If no parameter is passed, LPT1 is flushed.
cArrayName is the name of the array that will be created to hold the information returned.
cGroupSpec is an option specifier that limits the names of the groups returned.
cServerName is an optional server identifier. You can specify a different server to get the acct list from (besides the default server).
If a .T. is passed as the fourth parameter, the array created will be public.
Return Values
The number of groups on the server. The function also creates a two dimensional array where column 1 is the Group Name, and column 2 is the NetWare Object ID assigned to that group.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* The following example builds an array of all groups on the
* server, and performs a browse of them.
Set library to gplib
=N_GetGroup('GroupArr')
create cursor Groups (GroupName C(48), OB_ID C(8))
append from Array GroupArr
browse
*
* The second shows getting all groups from another server
Set library to gplib
=N_GetGroup('GroupArr','*','ADVERTISING')
create cursor Groups (GroupName C(48), OB_ID C(8))
cArrayName is the name of the array to store the information in.
cFileName is the name of the file to get the lock status for. The name of the file must be in the form VOLUME:PATH\FILENAME.EXT.
cServer is an optional server name where the file is. If this value is not passed, the default server is assumed.
If the optional parameter lPublic is passed, and is true (.T.) then the array created will be public. If this parameter is not passed, or is .F., then the array will be created private.
Return Values
NetWare return code.
152 File Not Found
198 Not a Console Operator
Upon successful completion, the function creates a three column array. The array structure is:
Connection Number
Task Number
Starting Byte Offset for Record Lock (See Comments)
One row will be created for each record lock or file lock on the file. In the case of a file lock, there will always be only one row returned.
Comments
The starting Byte Offset returned will be dependent upon whether your file has a CDX or not. Please refer to the sample program for information on interpreting this value.
This function can be useful for finding out what station has a record lock, or a file locked. This can be extremely useful in troubleshooting "deadly-embrace" situations.
The person executing this function must be a console operator. For more information on Console Operators, refer to your NetWare concepts manual.
This function only returns shared-mode file and record locks. If a file is used exclusively, it will not be reported by this function because it is not "locked", it is opened non-shareable. Only files that have FLOCK()'s or RLOCKS()'s against them will be returned.
Under Windows, and other multi-tasking operating systems, more than one task can have a file open, or have records locked.
It is not possible to "peek ahead" to determine what stations are requesting a lock. Short of placing an NLM on the server that would monitor lock calls, the only method of determining this is through the use of a hardware monitor. One such monitor would be a Sniffer by Network General.
This function requires that the GLOCKFIX.NLM patch be loaded on 3.11 and 3.12 servers. This function will work without the patch but if there are more than 23 record locks applied, the server returns erroneous information. The patch is available from Novell in the NetWire forum on CompuServe (Note: The name is the preliminary. The actual name of the published file may be different).
cArrayName is the name of the array that will be created to hold the information returned.
cQueueSpec is an optional specifier that limits the names of the queues returned.
cServerName is an optional specifier that tells the routine what server you wish to get a queue list from.
If a .T. is passed as the fourth parameter, the array created will be public.
Return Values
Number of queues found, and creates a two dimensional array where column 1 is the Queue Names, and column 2 is the NetWare Object ID assigned to that Queue. If a user does not have rights to a Queue, or that Queue has been set off by a Queue Operator (Users can place new Jobs in Queue set to NO) then that Queue will not be returned.
Comments
The object ID returned by this procedure corresponds to the queue directory in the SYS:SYSTEM directory.
For additional examples of how to use this function, please refer to the QMGR.PRG accompanying this program.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* The following example builds an array of queues on the
* server, and performs a browse of them.
Set library to gplib
=N_GetQList('QueueArr')
create cursor Queues (QueueName C(48), Q_Id C(8))
append from Array QueueArr
browse
* Get a List of HP Laser Queues from the engineering server
cArrayName is the name of the array to return the information to.
cObjectSpec is an optional specifier that limits objects returned.
cServerName is an optional specifier that permits reading the bindery of a server besides the default server.
If a .T. is passed as the fourth parameter, the array created will be public.
Return Values
The number of matches in the bindery. Creates a two dimensional array with three columns that contain the Object Name, Object ID, and the Object Type as a hexidecimal string.
All object types above 8000h are available for developers to use as they see fit. One interesting example of this is MicroTest LanPort/Intel NetPort devices have an object type of 8002h.
cPassword is the password for the login ID specified.
cServerName is the server's name.
Return Values
NetWare completion code:
0 - Successful
197 - Intruder detection activated
220 - Account Disabled
252 - No Such Object
254 - Login Disabled
255 - No Response From Server
Comments
If the login attempt was unsuccessful, you will still be attached to the server you tried to login to.
Executing this command WILL NOT execute either the system login script, or the users specific login script. It will be up to your program to provide any drive-mappings, or captures that would noramlly be done via the login script.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
set talk off
Set library to gplib
=N_GetSList('SLIST')
clear
store space(48) to userid, pword
&& Note: password can actually be 127 characters long
s_name=slist[1]
@3,5 Say "Server Name : " get s_name function '^' from SLIST
@7,5 Say "User ID : " Get Userid
@9,5 Say "Password: " Get Pword
read
s_name=alltrim(s_name)
userid=alltrim(userid)
pword=alltrim(pword)
result=N_Login(userid,pword,s_name)
if result =0
wait window 'Successfully logged in to file server : '+s_name
else
wait window 'Login FAILED. Result code was :'+ltrim(str(result))
N_LogInfo() - Get a workstations login date or time
Description
Read the login date or time for a specified workstation.
Usage
N_LogInfo( iWorkStation , 1 || 2)
If iWorkStation is 0, the login date for the user on the current station is returned, otherwise the login date or time for the user on the specified work-station is returned.
If the second parameter passed is 1, then the login date for the specified work station will be returned.
If the second parameter passed is 2, then the login time for the specified work station will be returned.
Return Values
Login date or time for specified work-station.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_LogInfo(0,1) && Print login date as date variable for my station
08/22/93
For LoopVar= 1 to N_MaxConns()
if (Date()-ctod(N_LogInfo(LoopVar,1))) > 1
? N_UserID(LoopVar)+' Logged in at '+N_LogInfo(LoopVar,1)+;
cServerName is the name of the server to logout from. If this parameter is not passed, you will be logged out of all servers.
lDetach is an optional parameter. If .T., then you will be detached from the specified server once you are logged out. If .F., you will be left attached to the specified server once you are logged out.
Return Values
.T. if successful, .F. otherwise.
Comments
If you use the detach option of this function, you must reset the server to a valid server (refer to example).
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
cServer=N_DefServr() && Save current server
* Login to the engineering server and copy a file to it then logout.
cServerName is the optional server name the queue resides on.
If the optional fourth parameter .t. is included, the array created will be public.
Return Values
Number of printjobs if successful, otherwise returns error code as a number > 10000. If the call was successful, a two dimensional array will be created holding the print job information. The columns are:
1 Job Number
2 Job Size
3 Job Description
4 Job Owner
5 Job Status ( Active, Adding, Ready, Hold-User, Hold-Oper )
Error Numbers
10,208 - Queue Error
10,209 - No Queue
10,211 - No Queue Rights
10,213 - No Queue Job
10,254 - Server Bindery Locked
10,255 - Bindery Failure
Comments
Because of design limitations in the Novell Queue system the maximum number of print jobs this function can return is 250. Under NetWare 3.X, the maximum number of print jobs is actually 65535.
In order to use this and other Queue functions the following conditions must apply.
To use N_LstQJobs() you must be either a queue user, or a queue operator.
To use N_DelQJob() you must be either the Job Owner, or a queue operator.
To use N_MoveQJob() you must be a queue operator.
For more information on how Novell handles queue rights and how to create queue operators, please refer to your NetWare documentation.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_LstQJobs('PRINTQ_0','QArray') && get jobs for Printq_0
For a more complete example of how to use this function, please refer to the QMgr.PRG that accompanies this program.
N_MaxConns() - Return Maximum NetWare connections.
Description
Return the highest number of NetWare connections supported by the default server.
Usage
N_MaxConns()
Return Values
Integer corresponding to the maximum number of concurrent logins the license for the default server permits.
Comments
Interestingly, some NLMs will "login" to the server at connection numbers higher than the License will permit. One example of this is the ArcServer from Cheyenne Software. Another example is the PSERVER NLM from Novell.
The purpose of this function is to return true if the person specified is a member of a specified group.
Usage
N_MemberOf( cUserName, cGroupName )
cUserName is the name of the person to check membership for.
cGroupName is the name of the group to check membership for.
Return Values
.T. if user is member of specified group, .F. otherwise.
Comments
An interesting place to use this function is in the MENU Builder, SKIP FOR condition. This allows you to have menu options that are only highlighted if the person is a member of the appropriate group.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
if .not. N_MemberOf(N_UserID(), 'HR')
WAIT WINDOW 'Error! You are not authorized to execute this program!'
Read/Return the current broadcast mode setting for the work station.
Usage
N_MsgMode( [iState] )
iState is an optional parameter. If this parameter is not passed, the current mode is returned. If this parameter is passed, then the message mode will be set to that specified. Valid modes are:
0 = Equivalent to CASTON. All messages will be received
1 = Equivalent to CASTOFF. Messages from server will be accepted. Messages from users will be discarded.
2 = Equivalent to CASTOFF /ALL. Messages from both the server, and other workstations will be disregarded. Messages from the server will be saved, and may be recalled with a call to N_MsgRtrv().
3 = Messages from both the server and other workstations will be stored at the server. The station may recall the messages by a call to N_MsgRtrv().
Return Values
Current station broadcast mode (See Usage).
Comments
If there is a message in the server buffer, waiting and the N_MsgMode() mode is changed from a store mode to 0, then that message will be immediately retrieved and displayed.
N_MsgRtrv() - Retrieve a stored message from the file server.
Description
Retrieve a stored message from the file server. Messages can be stored if the mode is set using N_MsgMode() to 2 or 3.
Usage
N_MsgRtrv()
Return Values
A string containing the stored message (or a null string if no message is waiting) if successful. If the call is unsuccessful, the function returns .F.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
=N_MsgMode(3) && save messages from users and the server
N_PwdDate() - Return date user's password expires.
Description
Return the date a users password expires
Usage
N_PwdDate( [ cUserID ] )
cUserID is the optional user ID to get the date for.
Return Values
Date network password expires as a DATE type.
Comments
To get the password for any user besides himself, the person executing this program must equivalent to that user, a manager over that user, or a supervisor equivalent.
To read the current capture parameters. This function allows programs to read the current capture parameters including FormFeed, Setup Strings, Reset Strings, Notify, Banner, etc.
Usage
N_RdPParms( cArrayName, iLPTPort [, .T. ])
cArrayName is the name of the array to create.
iLPTPort is the LPT Port to read. I.E. 1-3.
If the optional parameter of .T. is included, the array will be created as a public array.
Return Values
.T. always. The function also creates a 15 Element, 1 dimensional array that contains the capture parameters. Please refer to the list below for a description of each element.
Row Contents
1 Printer Setup Codes
2 Printer Reset Codes
3 Server Name
4 Queue Name
5 Form Number (0-255)
6 Form Name
7 Tab Size
8 Tab Expansion ( .t. or .f. )
9 Form Feed Flag ( .t. or .f. )
10 Notification Flag ( .t. or .f. )
11 AutoEndCap Flag ( .t. or .f. )
12 Banner Text
13 Banner Flag ( .t. or .f.)
14 Number of Copies (1-255)
15 Timeout in Seconds
Comments
Even if you use N_CapMode() or ENDCAP to end capture, this function will still return the parameters for your last effective capture. This is not an undocumented feature, it is just how NetWare works.
The form name field is for information only. It is totally disregarded by NetWare. If you use the N_StPParms() function, changing the Form Name will have absolutely no effect.
If you use form numbers, you must ensure that your customers understand forms, and more specifically how to inform NetWare that a form has been mounted.
The Printer Setup Codes and Printer Reset Codes are fixed length fields. When a station issues a capture with a J= parameter, these fields are where the setup and reset strings are stored. The default values for the size of these two buffers is 64 and 16 bytes respectively. If you wish to set aside a larger area for these buffers, you must put a setting in your SHELL.CFG file. For more specific information, please refer to your NetWare Installation manual.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
external array p_array
=N_RdPParms('P_Array',1)
Wait Window 'The current Queue is '+P_Array[4]+;
'. The current server is '+P_Array[3]
───────────────────────────────────
See Also: N_CapMode(), N_FlushLPT(), N_StPParms(), N_UserBnnr()
N_SerialNo() - Return NetWare Server Serial Number
Description
Return the NetWare serial number for the default server.
Usage
N_SerialNo()
Return Values
8 digit NetWare serial number formatted as a character string.
Comments:
Each copy of NetWare sold by Novell is serialized. This function returns that Novell assigned serial number. The exception to this is major accounts. Novell has entered into site license agreements with some very large corporations. It is entirely possible for one of these sites to have two servers with the same serial number.
You must be logged in to the server to get the serial number.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_SerialNo() && Get serial number of default server
=N_DefServr('ENGINEERING') && Set default server to engineering
cServerName is the name of the file server to attach to.
Return Values
.T. always
Comments
This function allows you to attach to different servers without logging in or out. This permits you to perform some operations, such as getting the MaxConnections, the server date and time, etc. without logging into that server.
Also note that you can only be logged in or attached to 8 file servers using the NetX shells. Using the VLM shells you can attach to more than 8 servers. This function does not support VLM shells. Trying to attach to more than 8 servers will generate an Error 1098, 'All connection slots in use.'
───────────────────────────────────
See Also: N_Attached(), N_DefServr(), N_LogOff(), N_Login(), N_ServDtch()
Set the extended attribute flags of a file on a NetWare file server.
Usage
N_SetAttr( cFileSpec, cAttribs)
cFileSpec is the file specification to process. It may include the DOS wild-card characters * and ?.
cAttribs are the attribute flags to modify. The flags are set in the format +<attribute> or -<Attribute>. Valid attribute flags are listed below.
H Hidden
A Archive
R Read Only
Y System
X Execute Only
S Shareable
T Transactional
I Indexed (NetWare 2.2 and lower)
Return Values
Number of files that had their attributes modified.
Comments
Do not flag compiled FoxPro .EXE files X (Execute only). Because these files contain overlays, they must be able to be read. Once a file is flagged execute only, the file cannot be read, copied, or unflagged.
Once a file is marked Transactional, it cannot be deleted. This also means that you cannot pack a DBF that is marked transactional.
If you flag a DBF transactional, please make sure that you flag all associated files (FPT, CDX, IDX) Transactional also.
N_SetDots() - Read or set the value of SHOW DOTS in the network shell.
Description
Read or set the value of SHOW DOTS for the station network shell.
Usage
N_SetDots( [ lMode ] )
If the optional parameter of lMode is passed then the setting of SHOW DOTS will be set to the specified mode.
Return Values
Current setting of SHOW DOTS.
Comments
This setting will affect how certain FoxPro functions work under NetWare. For example, ADIR() will not ordinarily return . and .. directory entries. If you set SHOW DOTS on, then it will.
Provide a system of using logical locks, with NetWare semaphores.
Usage
N_SetSem( cSemaphoreName, lMode [, cServerName ])
cSemaphoreName is the name of the semaphore to lock or unlock.
If lMode is true, the semaphore is locked. If lMode is .F., the semaphore is unlocked.
cServerName is the optional server name where the semaphore should reside.
Return Values
.T. if successful, .F. otherwise.
Comments
NetWare Semaphores allow the programmer to perform logical record locking rather than physical record locking. An example of this would be if you had multiple tables that you needed to update. With semaphores, you could lock the primary key (in the example PartNo) and then proceed. Using physical locks, it would be necessary to obtain locks on all the records in all the related tables in order to ensure that the transaction would be performed. The only catch to this idea is that ALL APPLICATIONS WHICH UPDATE THOSE TABLES MUST CONSISTENTLY USE THE SEMAPHORE LOCKING, AND CONSISTENTLY NAME THOSE SEMAPHORES.
It has been discussed in several books, and in several places, that although FoxPro can perform multiple locks in a DBF, an unlock command unlocks ALL records in that work area. If, however, you were to implement locks using semaphores as a logical locking system, then you can indeed release one lock in that work area.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
If N_SetSem(Accounts.Acct_No, .T.)
* Perform Edit of Account Master
=N_SetSem(Accounts.Acct_no, .F. )
else
Wait Window 'Unable to obtain lock on record for '+Accounts.Acct_no
N_SndFServ() - Broadcast a message from the server console
Description
Send a broadcast message to a specified user from the server console.
Usage
N_SndFServ( cUserID, cMessage )
cUserID is the user to send the message to.
cMessage is a character string holding the message. This message may be upto 55 characters long.
Comments
There are differing levels that you can set the broadcast mode for a station. It is possible to set the mode to ignore messages from other users, but accept messages from the server console. Sending a message using this function will get the message through if the person has used N_CastMode to set the current broadcast mode to 1.
Return Values
.T. if successful, .F. otherwise.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_SndFServ("Supervisor", 'Please mount CDROM volume')
───────────────────────────────────
See Also: N_ConsOper(), N_MsgBrd(), N_MsgMode(), N_MsgRtrv()
The purpose of this function is to allow programs to modify their current NetWare capture settings. This function allows programs to modify the FormFeed Flag, the notify flag, timeout functions, Setup and reset strings etc.
Usage
N_StPParms( cArrayName, iLPTPort )
cArrayName is the name of the array to read information from. The array used to alter the settings is in the form listed below.
iLPTPort is the LPT Port to set I.E. 1-3.
Row Contents
1 Printer Setup Codes
2 Printer Reset Codes
3 Server Name
4 Queue Name
5 Form Number (0-255)
6 Form Name
7 Tab Size
8 Tab Expansion ( .t. or .f. )
9 Form Feed Flag ( .t. or .f. )
10 Notification Flag ( .t. or .f. )
11 AutoEndCap Flag ( .t. or .f. )
12 Banner Text
13 Banner Flag ( .t. or .f.)
14 Number of Copies (1-255)
15 Timeout in Seconds
Return Values
NetWare completion code.
Comments
The form name field is for information only, it is totally disregarded by NetWare.
If you use form numbers, you must ensure that your customers understand forms, and more specifically how to inform NetWare that a form has been mounted.
The Printer Setup Codes and Printer Reset Codes are fixed length fields. When a station issues a capture with a J= parameter, these fields are where the setup and reset strings are stored. The default values for the size of these two buffers is 64 and 16 bytes respectively. If you wish to set aside a larger area for these buffers, you must put a setting in your SHELL.CFG file. For more specific information, please refer to your NetWare Installation manual.
Do not try to set the printer to a local printer by setting the 4th array element to null and calling N_StPParms(). To set the printer to local use N_CapMode() to toggle capture on or off.
For an implementation of the Novell Job system, please refer to the SetPJob.PRG accompanying this program.
Certain capture settings are ignored when using this function with FoxPro for Windows. The number of copies is one example. These problems arise because of how Windows handles printing.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
external array p_array
=N_RdPParms('P_Array',1) && Create our array with current settings
P_Array[9]=.F. && Set Form Feed Off
P_Array[1]="" && Null out setup & reset codes from last CAPTURE /J=
P_Array[2]=""
=N_StPParms('P_Array',1) && Make changes active
───────────────────────────────────
See Also: N_CapMode(), N_FlushLPT(), N_RdPParms(), N_UserBnnr()
N_SYSTime() - Synchronize the workstations clock with file server.
Description
Synchronize the stations time and date with that on the file server.
Usage
N_SYSTime( [ cServerName ] )
cServerName is the optional server name to get the time from.
Comments
This function is equivalent to running the Novell SYSTIME utility. This function reads the date and time from the file server, and then sets the DOS date and time to the same value. This function does not modify the value of the PCs internal real time clock. If you have a lengthy application where you would like to ensure the date and time are valid, but don't wish to re-write the application to use N_ServDate(), and N_ServTime(), then placing this function at the head of your program should be adequate. Bear in mind that if your program offers any sort of shell capability that users could change the clock using it. You might want to set your program so that N_SYSTIME() is executed after every shell command.
Generally, the worst case inaccuracy for this function is -2 seconds. This inaccuracy is due to 2 reasons. 1) NetWare only returns the server's time with resolution of 1 second. 2) The travel time from the server to the workstation is unknown, but assumed to be between 0 and 1 second (on a 386/25 PC, a FOR..NEXT loop executing this function took 3.25 seconds for 1000 iterations). So, we have a possible loss of .99 seconds because of the limited resolution in the NetWare time service, and an estimated loss of between 0 and 1 second for travel time from the server to the station, and some odd processing time. If you were performing this call to a server linked by a WAN or MAN, your transit time for the packet may vary. The result of all this reading and testing is: if you run this function against a local server, your PCs clock will, on average, be within .5 seconds of the server's time.
If you are looking for an accurate source to set the clock on your server to, you may wish to try (303) 499-7111. This is the number for the Atomic Clock located at the National Institute of Standards and Technology (Formerly NBS), located in Boulder, CO.
Return Values
.T. always.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
=N_Systime() && Station date & time are now synched with server.
=N_SysTime('ENGINEERING') && Synch clock to engineerings server.
cPath is the path or file name to return the trustee list for. cPath must be in the form <VOLUME>:<PATH>\<NAME>.
cServer is the optional parameter specifying what server the file resides on. If this parameter is not passed, the default server is assumed.
lPublic is an optional parameter specifying whether the array to be created should be public or private. If lPublic is passed, and .T., the the array created will be public.
Return Values
Creates a two dimensional array where column 1 is the object name and column 2 is the object type, and column 3 is the rights mask for the object. Returns as an integer the number of trustees found.
If the directory does not exist, you do not have rights to that directory, or there are no trustees, the function returns 0.
If an error occurs, the function returns the NetWare Error code as a negative number. Error codes are:
-152 Volume Does Not Exist
Comments:
This function works only on NetWare 3.11 and higher.
cPath is the file or directory name to change trustee rights for. cPath must be in the format <VOLUME>:<PATH>\<NAME>.
cFlags are the new permissions to assign to the directory or path. Allowed flags are:
R Read
W Write
C Create
E Erase
A Access Control
F File Scan
M Modify
S Supervisory
N Normal (All rights but A and S)
ALL All rights
iObjectType is an optional parameter specifying object type. The default value is 1 (USER). Allowed values are:
1 User
2 User Group
cServer is the optional server where the file resides. If this parameter is not passed, the default server is assumed.
Return Values
0 Success
152 Volume Does Not Exist
156 Path or File Does Not Exist
255 No Rights To Modify Trustee
Comments
This function only works on NetWare 3.11 and higher.
In order to use this function, you must have ACCESS control rights to the directory or file you specify.
Rights granted to a file apply only to that instance of the file. For example, if you grant rights to a file, and then pack the file, all users will lose rights to the packed file. This is because the packed file is actually a new directory entry.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
use ACCOUNTS
PACK
USE
* Grant read rights to group everyone for the accounts table
The purpose of this function is to return or set the availability of TTS on a server. Used with no parameter, the function returns if TTS is available. Used with a parameter, it turns TTS on or off.
Usage
N_TTSAvail( [lAvailable] )
If the optional parameter lAvailable is .T., TTS is enabled. If lAvailable is .F., TTS is disabled.
Return Values
If no parameter is passed, the function returns .T. if TTS is available, and .F. if it is not.
If a parameter is passed, the function returns .T. if the status was changed, .F. otherwise.
Comments
To use the set feature of this function, the person logged in must be a console operator.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
* Query current TTS status
?N_TTSAvail()
.T.
* Disable TTS
?N_TTSAvail(.f.) && Assumes I am a console operator
.T.
* Enable TTS
?N_TTSAvail(.T.)
.T.
───────────────────────────────────
See Also: N_SetAttr(), N_TTSBegin(), N_TTSCommt(), N_TTSRollB(), N_TTSStat()
The purpose of this function is to signal to the NetWare operating system that an explicit TTS transaction has begun.
Usage
N_TTSBegin()
Return Values
NetWare completion code:
0 Success
150 Out of Dynamic Workspace
254 Implicit Transaction Already Active. Implicit transactions will be converted to explicit transactions
255 Explicit Transaction Already Active. Existing transaction will continue normally.
Comments
There are some very serious pitfalls to be aware of when using TTS with FoxPro and NetWare. Generally speaking, TTS is only recommended for non-interactive batch update processes. Some of the problems with TTS are:
If you issue an APPEND BLANK or INSERT INTO command while a TTS Transaction is active, the DBF header will be locked until the transaction is committed or rolled back. When you issue an append, the record count located in the first 32 bytes of the header is modified. This means that no other users may issue an APPEND BLANK or even issue a USE <DBFName> until the transaction is committed.
Records locked during a TTS transaction remain locked until the transaction is committed or rolled back. This lock, unlike a normal FoxPro lock, prevents other users from examining affected records.
If the changes haven't been written to disk, then a roll-back will not work. For example:
use test
=N_TTSBegin()
append blank
replace field1 with 1
=N_TTSRollB()
use
will not always have the expected outcome. Because the changes haven't been written to disk yet by FoxPro, Novell can't roll them back. To work around this problem, you should issue a FLUSH command before any RollBack commands.
There is a real limit to how large your transaction can be. Under NetWare 3.11, the maximum number of record locks per connection is 10,000. Thus, the theoretical maximum number of locks in a single transaction is 10,000. In reality, the number will depend upon your server's available memory and disk space. It is recommended by Novell that you perform updates on a small number of records in each transaction.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
private nTransNo
if N_TTSAvail() and N_SetAttr('TEST.DBF')
use test
=N_TTSBegin() && Start the transaction
browse && Make our changes
FLUSH
if yes('Write changes to disk?')
nTransNo=N_TTSCommt() && Get the transaction number
*
* Now wait until we are sure changes are written by the NetWare OS.
*
do while not N_TTSStat(nTransNo)
=inkey(.5)
enddo
=MsgWin('Transaction written to disk!')
else
=N_TTSRollB()
=MsgWin('Transaction rolled back!')
endif
use
else
=MsgWin('TTS was not available!')
endif
───────────────────────────────────
See Also: N_SetAttr(), N_TTSAvail(), N_TTSCommt(), N_TTSRollB(), N_TTSStat()
Read/Set the user name printed on the banner page of a print job.
Usage
N_UserBnnr( [ cUserName ] )
If the optional parameter cUserName is not passed, then the function will return the current user-name printed on the banner.
If the optional parameter cUserName is passed then the function will set the user-name printed on the banner to that value. Only the first 12 characters of the passed name will be used.
Return Values
User-name that will be printed on the banner page.
Comments
When you capture using Novell's CAPTURE command, it sets the banner user-name. If a user logs into a station and then capture is initiated using another method (N_StPParms() for example), then the user-name stored by the work-station shell will not be updated. This command provides a method of working around this problem.
Return the NetWare user id of the a station. If the station is not logged in, the function returns a null string.
Usage
N_UserID( [iStationNumber] )
iStationNumber is the optional station number to retrieve the Login ID for. If this parameter is ommitted, the Login ID of the person on the executing station will be returned.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
Set Library to GPLIB
use Journal
Append Blank
Replace User_ID with N_UserID(), Date with ;
N_ServDate(), Action with "Added record to personnel file."
select Personnel
Append Blank
Edit
Close Data
*
* The second example demonstrates a user list function
N_UserName() - Return full name of a specified user or station.
Description
Return the full user name for the connection number specified. If no connection number is specified, the full name for the user logged in on the executing machine is returned. Optionally, you may specify the character name of a USER OBJECT only, and get the full name. At this time, you cannot specify the character name for a Print Server, or other object.
Usage
N_UserName( iStationNumber | cLoginID )
iStationNumber is the optional station number to get the name for.
cLoginID is the optional name of the LoginID to get the name for.
Return Values
Full name as entered in the NetWare bindery. If no full name is specified the function returns < (OBJECT TYPE) - No Full Name >.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
?N_UserName(2)
Bill Smith
?N_UserName('BillS')
Bill Stanley, x2322
?N_UserName(3)
< User - No Full Name >
* Display a list of users currently logged in, and their full names
The purpose of this function is to verify a user's network password. Using this function, a programmer can force a user to reenter his network password before entry into an application. This simplifies network & application administration, by not requiring multiple passwords for applications. An additional benefit of this method is the users password stays stored in the bindery. Using this procedure provides an additional layer of security in case your users leave their computers logged in at a system menu.
Usage
N_VerPwd( cPassWord )
cPassWord is the user's Novell NetWare password.
Return Values
0 - Successful (Password Correct)
197 - Account Locked By Intruder Lockout Detection
240 - Wildcard Not Allowed
251 - No Such Property
252 - No Such Object
254 - Server Bindery Locked
255 - Failure (No such object or bad password)
Comments
If your network has intruder detection lockout turned on, and a call is made to this routine unsuccessfully <N> times, the account for that user will be locked.
╓─────────────────────────────────╖
║ Examples ║
╙─────────────────────────────────╜
Store space(127) to PassWord
@5,5 Say 'Please enter password for entry to payroll files ' Get PassWord Picture "@S40"
The purpose of this function is to set the limits of travel for the mouse cursor. An example of this would be creating a message window and restricting the mouse cursor to the inside of the window.
Usage
SetMLimit( iY1, iX1, iY2, iX2 )
iY1 is the upper Y Limit
iX1 is the left X Limit
iY2 is the lower Y Limit
iX2 is the right x Limit
Comments
This function only works in FoxPro DOS. A call to this function in FoxPro for Windows will be ignored. You might want to use the SCOLS(), and SROWS() function to reset mouse limits. This will allow the program to work in any display mode for FoxPro.
The purpose of this function is to return a unique file name. This function requires that the machine be operating on a Novell Network.
Usage
UniqueName()
Return Values
A unique file name which consists of:
'$T' + Network Station Number in Hex + a sequential number starting at 1, and returned in hexadecimal.
Comments
Fox's SYS(3) purports to return a unique file name, but it actually returns a random file name. Because this function incorporates the NetWare station number in it's result, it is a guaranteed unique file name.