Dec 152017
FoxPro 2.0 group of network utilities to use in your applications. | |||
---|---|---|---|
File Name | File Size | Zip Size | Zip Type |
GPLIB.DOC | 34279 | 8889 | deflated |
GPLIB.PLB | 17443 | 10657 | deflated |
Download File GPLIB.ZIP Here
Contents of the GPLIB.DOC file
***********************************************************************
*
* DOC for GPLIB.PLB (Version 1.02) (3 Feb, 1992)
*
*by George Sexton CIS [73237,1665]
*
* This is being put in the public domain for use by anyone
* who wants it. This means, of course, that you use it at
* your own risk. If you find an error though, please notify
* me via CompuServe, and I will try to resolve it.
*
* GPLIB is a general purpose FoxPro 2.0 library with some NetWare
* functions built into it.
*
* What's new since version 1.00:
*
*ShftPrtScr() - Invoke Hardware Interrupt 5 (Shift Printscreen)
*N_GetMaTyp() - NetWare long machine type
*N_GetSMTyp() - NetWare short machine type
*N_GetOSTyp() - NetWare os type
*N_GetOSVer() - NetWare os version
*N_IsMap() - Is a drive mapped to a NetWare Server
*N_Map() - NetWare drive map command
*N_MapRem() - NetWare map delete command
*N_Detach() - NetWare Detach from file server.
*N_LogoutFS() - Logout from a specific file server
*N_Logout() - Logout of all servers.
*N_ServName() - Return File Server Name For Drive
*N_Date() - NetWare file server date
*N_Attach() - Attach to a file server.
*N_LoginFS() - Login to a file server.
*N_IsAttach() - Return whether attached to a server.
*N_Time() - NetWare file server time
*N_GetQList() - NetWare get queue list
*N_GetGroup() - NetWare get group list
*N_GetSList() - NetWare get server list
*N_AcctList() - NetWare get user acct list
*N_GetWild() - NetWare scan bindery for wild cards
*N_IsMember() - Now accepts an optional user id to check membership for.
* N_IsEquiv() - Now accepts an optional user id to check equivalence for.
*
*
* If you have any comments, or requests for enhancements, please
* pass them along, and I will see what I can do. -George-
*
*******************************************************************
*******************************************************************
*
*
*AboutGPLIB() - Return version information for GPLIB
*CtlAltShft() - Return true if control, alt, or shift key is held down
*FileCount() - Function to return # of matching files in a directory.
*FKillAll()- Wild Card File Erase
*Flag()-Set DOS file attributes.
*Math_Chip() - Return true if a 80x87 math coprocessor is installed.
*Make_Dir() - Create directory.
*MReset() - Perform mouse reset.
*Num_Serial() - Return Number of Serial Ports
*N_AcctList() - Return list of user accounts from server.
*N_Attach() - Attach to a file server.
*N_Date() -Return File Server Date
*N_Detach() - Detach from file server
*N_DfServer() - Change default server.
*N_FlushLPT() - Flush capture of specified LPT port.
*N_FullName() - Return users full name
*N_GetGroup() - Return list of groups from server.
*N_GetMaTyp() - Get Long Machine Type
*N_GetOSTyp() - Return Operating System Type
*N_GetOSVer() - Return Operating System Version
*N_GetQList() - Return List of Queues from server.
*N_GetSList() - Return List of Servers from the file server.
*N_GetSMTyp() - Get Short Machine Type
*N_GetWild() - Get List Of all bindery objects from server.
*N_IsAttach() - Return whether attached to a server.
*N_IsEquiv()-Return Security Equivalence
*N_IsMap - Is drive mapped to a NetWare file server.
*N_IsMember()-Return Group Membership
*N_LogDate()-Return Login date
*N_LoginFS() - Login to a file server.
*N_LoginID() - Return NetWare User ID
*N_Logout() - Logout of all file servers.
*N_LogoutFS() - Logout of specified file server.
*N_LogTime()-Return Login Time
*N_Map()-Map a drive
*N_MapRem() - Remove A drive mapping
*N_NukeSta() - Clear Specified Connection Number
*N_ServerID() - Return ID number of specified server
*N_ServFrID() - Return server name from connection ID
*N_ServName() - Return file server name for a mapped drive
*N_ShellVer() - Return Shell Version
*N_StaAddr() - Return Physical station Address
*N_StaID() - Return NetWare station number.
*N_Time() - Return File Server Time
*N_VerPwd() - Verify a users password
*Rem_Dir() -Remove a directory
*SetMLimit() - Set Mouse Limits
*SetMPos() -Set Mouse Cursor Position
*ShftPrtScr() - Invoke Hardware Interrupt 5 (Shift-Printscreen)
*TrimLen()-Return Trimmed Length of a String
*UniqueName() - Return unique file name
******************************************************************
____________________________________________________________________
AboutGPLIB() - Return version information for GPLIB
Purpose
Return the current version number of GPLIB.PLB
Syntax
AboutGPLIB()
Returns
.T.
Note
This function displays the current version number of GPLIB in
a WAIT WINDOW.
____________________________________________________________________
CtlAltShft() - Return true if control, alt, or shift key is held down
Purpose
Return true if the Control, Alt or Shift key is held down.
Syntax
? CtlAltShft()
Example
This example shows how you could use CtlAltShft in a program to
hide the window when the user presses one of those keys.
define window Disp_msg from 10,10 to 20,70 double float
activate window disp_msg
?' This is a message '
do while lastkey()<>27
=inkey(.5,'H')
If CtlAltShft()
hide window disp_msg
do while CtlAltShft()
* nothing
enddo
Show Window disp_msg
Endif
enddo
_________________________________________________________________________
FKillAll()- Wild Card File Erase
Purpose
The purpose of this function is to perform a wild-card file erase.
Standard DOS wildcards '?' and '*' are supported.
Syntax
?FKillAll( )
is the file spec of the files you wish deleted.
Returns
Number of files deleted.
Note
If the files you wish to deleted are flagged read-only, you must set
them to normal before calling this function.
Example
?FKillAll('*.bak') && Erase all .bak files
_______________________________________________________________________
FLAG()-Set DOS file attributes.
Purpose
To set the DOS file attribute for a file or files.
Syntax
?flag(,)
is the name of the file to change. Standard DOS
wildcards of '?' and '*' are supported.
is the attributes to change. Supported attribute
flags are:
R - Read Only
H - Hidden
S - System
A - Archive
flags are in the format +R, to set that attribute bit, or -R 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
____________________________________________________________________
MATH_CHIP() - Return true if a 80x87 math coprocessor is installed.
Purpose
Return a boolean true if a math coprocessor is installed in the
executing machine.
Syntax
?Math_Chip()
Returns
.T. if math coprocessor installed.
.F. if math coprocessor not installed.
Note
This function reads the BIOS equipment list to get the result.
In my experience, this should be adequate for all needs.
If you need a routine to check the actual existence by performing
a floating point test, then I would recommend the MathChip routine
in FoxPro2 A Developer's Guide (M&T Books), chapter 16.
__________________________________________________________________________
MAKE_DIR() - Create directory.
Purpose
The purpose of this routine is to create a DOS directory.
Syntax
MAKE_DIR()
is the name of the directory to create
Returns
.T. if successful, .F. otherwise
Example
if .not. make_dir('C:\MyProg\Temp')
?'Unable to create directory'
else
?'Directory created'
endif
Note
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.
__________________________________________________________________________
MRESET() - Perform mouse reset.
Purpose
To reset the mouse
Syntax
MRESET()
Returns
AX register.
________________________________________________________________________
Num_Serial() - Return Number of Serial Ports
Purpose
To return the number of serial ports installed in a machine.
This can be useful in developing machine inventory programs
in FoxPro.
Syntax
?Num_serial()
Returns
Number of serial ports installed on machine.
_______________________________________________________________________
N_AcctList - Return list of user accounts from the server.
Purpose
To return an array containing all user accounts on the default server.
Syntax
N_AcctList([,, ])
C_ArrayName is the name of the array that will be created to hold
the information returned.
C_AcctSpec is an option specifier that limits the names of the
accounts returned.
C_ServerName is an optional server identifier. You can specify a
different server to get the acct list from (besides the default
server).
Returns
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.
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_AcctList('UserArr')
create cursor USERS (UserName C(48), User_OB_ID C(8))
append from Array UserArr
browse
*
* The second example finds a users mail directory
=N_AcctList('Dummy',N_LoginID())
path='F:\MAIL\'+dummy[1,2]
?path
*
* This example demonstrates getting a list of users from a different
* server. Note user of '*' as C_AcctSpec
Set library to gplib
=N_AcctList('UserArr','*','Engineering')
create cursor USERS (UserName C(48), User_OB_ID C(8))
append from Array UserArr
browse
Note
The NetWare ObjectID is the same as the users mail ID.
_______________________________________________________________________
N_Attach() - Attach to a file server.
Purpose
To attach to a NetWare file server but not login.
Syntax
N_Attach()
C_ServerName is the name of the file server to attach to.
_______________________________________________________________________
N_Date() - Return server date.
Purpose
To return the current system date from the network file server.
Syntax
N_Date()
Returns
Server date as a character string in the format MM/DD/YY. If YY
is less than 80, it is considered to be in the twenty-first century
Example
* This mythical example shows how you could implement a journaling
* system to record changes to key tables. Because the system
* date and time are retrieved directly from NetWare, they can safely
* be considered secure, and immune from tampering.
*
if updated()
select journal
replace date with ctod(N_DATE()), time with N_time(), user with;
N_LoginID, action with 'modified record', key with partno
endif
___________________________________________________________________________
N_Detach() - Detach from file server.
Purpose
To detach from a specified file server.
Syntax
N_Detach()
C_ServerName is the name of the server to detach from.
Returns
.T. if successful, .F. otherwise.
Example
if N_Detach('ENGINEERING')
?'connection to engineering server cleared'
endif
___________________________________________________________________________
N_DfServer() - Change default server
Purpose
To change the default server request packets are sent to.
Syntax
N_DfServer()
C_ServerName is the name of the server to set the default to.
Returns
Connection Number of specified server.
Example
* Display a list of users currently logged in, and their full names
* on the engineering server.
=N_DfServer("ENGINEERING")
Max_Conns=250
for loop=1 to Max_Conns
if len(N_LoginID(loop))>0
?str(loop,3), PADR(n_loginid(loop),12),padr(n_fullname(loop),40),n_logdate(loop), n_logtime(loop)
endif
endfor
___________________________________________________________________________
N_FlushLPT() - Flush specified LPT port
Purpose
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.
Syntax
N_FlushLPT([])
I_PortNumber is the LPT port to flush. If no parameter is passed,
LPT1 is flushed.
Returns
NetWare result code
___________________________________________________________________________
N_FullName() - Return Users fullname
Purpose
To return the full 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.
Syntax
N_FullName([])
is the optional station number to get the name for.
Returns
Full name as entered in the NetWare bindery. If no full name is specified
the function returns < (OBJECT TYPE) - No Full Name >.
Example
?n_fullname(2)
Bill Smith
?N_fullname(3)
< User - No Full Name >
* Display a list of users currently logged in, and their full names
Max_Conns=250
for loop=1 to Max_Conns
if len(N_LoginID(loop))>0
?str(loop,3), PADR(n_loginid(loop),12),padr(n_fullname(loop),40),n_logdate(loop), n_logtime(loop)
endif
endfor
___________________________________________________________________________
N_GetMaTyp() - Return Long Machine Type
Purpose
The purpose of this function is to return the long machine type of
the executing station.
Syntax
N_GetMaTyp()
Note
For information concerning machine types, refer to Novell's
installation manuals.
Example
If N_GetMaTyp()='NOHARD'
?' This machine has no hard drive'
endif
___________________________________________________________________________
N_GetOSTyp() - Machines Operations system
Purpose
To return the operating system of the executing machine.
Syntax
N_GetOSTyp()
Example
?N_GetOSTyp()
MSDOS
___________________________________________________________________________
N_GetOSVer() - Return machine operating system version
Purpose
Return the operating system version of the executing machine.
Syntax
N_GetOSVer()
Example
?N_GetOSVer()
V3.31
___________________________________________________________________________
N_GetQList() - Return a list of print queues.
Purpose
To return a list of available print queues.
Syntax
N_GetQList([,, ])
C_ArrayName is the name of the array that will be created to hold
the information returned.
C_QueueSpec is an optional specifier that limits the names of the
queues returned.
C_ServerName is an optional specifier that tells the routine what
server you wish to get a queue list from.
Returns
Number of queues found, and a two dimensional array where column
1 is the Queue Names, and column 2 is the NetWare Object ID
assigned to that Queue.
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_GetQList('UserArr')
create cursor Queues (QueueName C(48), Q_Id C(8))
append from Array UserArr
browse
Note
The object ID returned by this procedure corresponds to the queue
directory in the SYS:SYSTEM directory.
___________________________________________________________________________
N_GetSList() - Return a list of servers.
Purpose
To return a list of available servers.
Syntax
N_GetSList( )
C_ArrayName is the name of the array that will be created to hold
the information returned.
Returns
Number of servers found, and a one dimensional array where
column 1 is the Server Names,
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_GetSList('UserArr')
create cursor Servers (ServerName C(48))
append from Array UserArr
browse
___________________________________________________________________________
N_GetSMTyp() - Return Short Machine Type
Purpose
The purpose of this function is to return the short machine type of
the executing station.
Syntax
N_GetSMTyp()
Note
For information concerning machine types, refer to Novell's
installation manuals.
Example
?N_GetSMTyp()
IBM
___________________________________________________________________________
N_GetWild - Return Array listing all objects in bindery.
Purpose
To return an array containing a list of all objects in the bindery.
Syntax
N_GetWild([,, ])
C_ArrayName is the name of the array to return the information to.
C_ObjectSpec is an optional specifier that limits objects returned.
C_ServerName is an optional specifier that permits reading the
binder of a server besides the default server.
Returns
The number of matches in the bindery. Creates a two dimensional array
that contains the Object Name, Object ID, and the Object Type as a
hexidecimal string.
Object Type meanings:
0000h-Unknown0008h-Archive Queue
0001h-User0009h-Archive Server
0002h-User Group000Ah-Job Queue
0003h-Print Queue000Bh-Administration
0004h-File Server0024h-Remote Bridge Server
0005h-Job Server0047h-Advertising Print Server
0006h-Gateway8000h-Reserved up to 8000h
0007h-Print ServerFFFFh-Wild
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.
Example
Set library to gplib
?N_getwild('ObArray','*','Engineering')
create cursor ObArray (ObName C(48), OB_ID C(8), OB_TYPE C(4))
append from array ObArray
index on ob_type tag ob_type
browse
___________________________________________________________________________
N_IsAttach() - Return whether attached to a file server.
Purpose
To return whether a workstation is attached to the specified file
server.
Syntax
N_IsAttach()
C_ServerName is the server name to check.
Returns
.T. if attached, .F. otherwise.
Example
?N_IsAttach("ENGINEERING")
.T.
___________________________________________________________________________
N_IsEquiv()-Return Security Equivalence
Purpose
The purpose of this function is to return true if the person on the
executing machine is equivalent to the specified user.
Syntax
N_IsEquiv([,])
is the name of the user to check equivalence for.
is optional name of the person to check equivalence
for. If ommitted, it defaults to the person currently logged in.
Returns
.T. if user is equivalent to, .F. otherwise.
Example
If .not. N_IsEquiv('Supervisor')
WAIT WINDOW 'You must be a supervisor equivalent to run this program!'
CANCEL
endif
________________________________________________________________________
N_IsMap() - Return whether a drive is mapped.
Purpose
To return whether or not a drive letter is mapped to a NetWare file
server.
Syntax
N_IsMap()
C_DriveLetter is the drive letter to check
Returns
.T. if drive is mapped, .F. otherwise.
Example
if .not. N_IsMap('M')
N_Map("M","SYS:GROUP\PAYROLL")
endif
________________________________________________________________________
N_IsMember()-Return Group Membership
Purpose
The purpose of this function is to return true if the person on the
executing machine is a member of a specified group.
Syntax
N_IsMember([,])
is the name of the group to check membership for.
is optional name of the person to check membership
for. If ommitted, it defaults to the person currently logged in.
Returns
.T. if user is member of specified group, .F. otherwise.
Example
if .not. N_IsMember('HR')
WAIT WINDOW 'Error! You are not authorized to execute this program!'
CANCEL
endif
_______________________________________________________________________
N_LogDate() - Get a workstations login date
Purpose
Returns the login date of the specified work station. If no workstation
is specified, it returns the login date of the current workstation.
Syntax
N_LogDate([])
is the workstation to get the login date for.
Returns
Login Date as a character string.
Example
For LoopVar= 1 to 250
if (Date()-ctod(N_LogDate(LoopVar))) > 1
? N_LoginID(LoopVar)+' Logged in at '+N_LogDate(LoopVar)+;
' and has not logged out as of : '+dtoc(date())
EndFor
______________________________________________________________________
N_LoginFS() - Login to file server.
Purpose
To Login a station into a file server.
Syntax
N_LoginFS(,,
C_ServerName is the servers name.
C_LoginID is the login ID to use.
C_Password is the password for the login ID specified.
Returns
A numeric code:
0-Successful
197-Intruder detection activated
252-Unknown file server
255-No Response From Server
Example
set talk off
Set library to gplib
=N_GetSList('SLIST')
clear
store space(48) to userid, pword
&& Note: password can actually be 128
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_Loginfs(s_name,userid,pword)
if result =0
wait window 'Successfully logged in to file server : '+s_name
else
wait window 'Login FAILED. Result code was :'+ltrim(str(result))
endif
_______________________________________________________________________
N_LoginID() - Return NetWare User ID
Purpose
To return the NetWare user id of the a station.
Syntax
N_LoginID()&& Return User ID of Current Station
N_LoginID() && Return User ID Of Person Logged in
&& at StationNumber
_______________________________________________________________________
N_LogTime() - Get a workstations login time
Purpose
Returns the login date of the specified work station. If no workstation
is specified, it returns the login date of the current workstation.
Syntax
N_LogTime([])
is the workstation to get the login time for.
Returns
Login Time as a character string.
Example
For LoopVar= 1 to 250
if (Date()-ctod(N_LogDate(LoopVar))) > 1
?N_LoginID(LoopVar)+' Logged in at '+N_LogDate(LoopVar)+;
N_LogTime(LoopVar)+' and has not logged out as of : '+;
dtoc(date())
EndFor
___________________________________________________________________________
N_Map() - Map a drive
Purpose
The purpose of this function is to map a drive on the network.
Syntax
N_Map(,)[,])
C_Letter is the drive letter.
C_Path is the path in the form ':'
C_ServerName is the optional name of the file server to
map the drive on.
Returns
0-Success
152-Volume Does Not Exist
156-Path does not exist
Example
?n_map('m','sys:public')
0
?N_Map('m','SYS:DBDATA','ENGINEERING')
&& Map drive m to SYS:DBDATA on the ENGINEERING server.
___________________________________________________________________________
N_MapRem() - Remove a drive mapping.
Purpose
To remove a network drive mapping.
Syntax
N_MapRem()
C_Letter is the drive letter to delete.
Returns
0-Success
155-Bad Directory Handle
___________________________________________________________________________
N_NukeSta() - Clear Specified station
Purpose
The purpose of this function is to clear the specified network station
number.
Syntax
N_NukeSta()
I_StationNumber is the station number to clear.
Note
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 (I did this folks, believe me). This command
was included, because there was some interest on the FoxForum in
such a command.
Example
* Clear all users logged in as PRODUCTION, PIC, or INVENTORY 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.
*
for loop= 1 to 250
if N_LoginID()$' PRODUCTION PIC INVENTORY '
=N_NukeSta(Loop)
endif
endfor
___________________________________________________________________________
N_ServerID() - Return server connection number.
Purpose
The purpose of this function is to return the connection number of
the specified file server.
Syntax
N_ServerID()
C_ServerName is the name of the server to get the connection
number for.
Returns
Integer connection number (1 to 8) of the specified server.
___________________________________________________________________________
N_ServFrID() - Return server name.
Purpose
To return the name of the server from the specified connection number.
Syntax
N_ServFrID([])
I_ConnectionNumber is the connection number of the server to
get. If the parameter is ommitted, the name of the default
file server is returned.
Returns
Name of specified server, or default server.
Example
?N_ServFrID()
ACCTG
?N_ServFrID(2)
ENGINEERING
___________________________________________________________________________
N_ServName() - Return Server name.
Purpose
To return the name of the file server that a drive is mapped to.
Syntax
N_ServName()
C_DriveLetter is the drive letter to check.
Returns
Server name as character string.
Example
?N_ServName('m')
ENGINEERING
___________________________________________________________________________
N_ShellVer() - Return Shell Version
Purpose
The purpose of this function is to return the NetWare Shell version.
Syntax
N_ShellVer()
Returns
The NetWare Shell version in the format
. ()
where Shell Type is:N for NETx
E for EMSNETx
X for XMSNETx
___________________________________________________________________________
N_StaAddr() - Return Physical station Address
Purpose
To return the 12 digit physical node address of the computer
the program is running on.
Syntax
N_STAADDR()
Returns
12 digit physical node address in hexadecimal
Example
?N_StaAddr()
0000C029512D
___________________________________________________________________________
N_StaID() - Return NetWare station number.
Purpose
To return the NetWare Station Number for the current machine.
Syntax
N_StaID()
Returns
The NetWare station number as an integer.
Example
ScratchFile='$T'+alltrim(str(N_StaID))+'TEMP.FIL'
copy structure to (ScratchFile)
use (scratchFile) ALIAS Scratch
* Perform some kind of processing
use
erase (scratchFile)
_______________________________________________________________________
N_Time() - Return File Server Time.
Purpose
To return the current system time from the file server.
Syntax
N_Time()
Example
* This mythical example shows how you could implement a journaling
* system to record changes to key tables. Because the system
* date and time are retrieved directly from NetWare, they can safely
* be considered secure, and immune from tampering.
*
if updated()
select journal
replace date with ctod(N_DATE()), time with N_time(), user with;
N_LoginID(), action with 'modified record', key with partno
endif
_______________________________________________________________________
N_VerPwd() - Verify a users password
Purpose
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.
Syntax
N_VerPwd()
is the user's Novell Network password.
Returns
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)
Note
If your network has intruder detection lockout turned on, and a
call is made to this routine unsuccessfully times, the account
for that user will be locked.
Example
@5,5 Say 'Please enter password for entry to payroll files ' Get PassWord
Read
PassWord=Alltrim(PassWord)
if N_VerPwd(PassWord)<>0
WAIT WINDOW 'Error Access Denied!'
CANCEL
endif
* Main application for payroll
_______________________________________________________________________
REM_DIR() -Remove a directory
Purpose
Remove a DOS directory
Syntax
?Rem_Dir()
Returns
.T. if successful, .F. otherwise.
Example
?REM_DIR('C:\TEMP\TEMP1')
.T.
Notes
Normal DOS limitations about removing directories also apply to this
function. I.E. the directory you remove must be empty.
__________________________________________________________________________
SetMLimit() - Set Mouse Limits
Purpose
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. Granted a MODAL read is effectively the same, I just think
users might get the idea more if they couldn't move the cursor
outside the window.
Syntax
?SetMLimit(,,,)
Where:
I_Y1 is the upper Y Limit
I_X1 is the left X Limit
I_Y2 is the lower Y Limit
I_X2 is the right x Limit
Returns
.T.
________________________________________________________________________
SETMPOS() -Set Mouse Cursor Position
Purpose
Set the mouse cursor position on the screen.
Syntax
?SETMPOS(,)
Where
I_Y1 is the Y axis coordinate
I_X1 is the X axis cooardinate
Example
* Issue Push Button @ Says
=SetMPos(10,10)
Read && The mouse character is now on the OK button
Returns
.T.
______________________________________________________________________
ShftPrtScr() - Invoke hardeare interrupt 5 to perform a Shift-Printscreen
Purpose
Invoke hardeare interrupt 5 to perform a Shift-Printscreen
Syntax
ShftPrtScr()
Returns
.T. always.
______________________________________________________________________
TRIMLEN()-Return Trimmed Length of a String
Purpose
The purpose of this function is to return the LEN of an
ALLTRIM'd string. It is functionally equivalent to
LEN(ALLTRIM(string)).
Syntax
TrimLen()
is the character expression to check.
Example
if TrimLen(MyUserInput)=0
return
else
* process input
endif
_____________________________________________________________________
UniqueName() - Return unique file name
Purpose
The purpose of this function is to return a unique file name. This
function requires that the machine be operating on a Novell Network.
Syntax
UniqueName()
Returns
A unique file name which consists of:
'$T' + Network Station Number in Hex + a sequential number starting
at 1, and returned in hexadecimal.
Notes
Fox's SYS(3) purports to return a unique file name, but it actually
returns a random file name. I have had a program die in a training
room because 7 people on 7 identical machines tried to run a program.
Because this function incorporates the NetWare station number in it's
result, it is a guaranteed unique file name.
Example
Use MyFile
Scratch=UniqueName()
Copy Structure to (Scratch)
use (scratch) exclusive alias scratch
* perform processing
use
erase (scratch+'.dbf')
*
* DOC for GPLIB.PLB (Version 1.02) (3 Feb, 1992)
*
*by George Sexton CIS [73237,1665]
*
* This is being put in the public domain for use by anyone
* who wants it. This means, of course, that you use it at
* your own risk. If you find an error though, please notify
* me via CompuServe, and I will try to resolve it.
*
* GPLIB is a general purpose FoxPro 2.0 library with some NetWare
* functions built into it.
*
* What's new since version 1.00:
*
*ShftPrtScr() - Invoke Hardware Interrupt 5 (Shift Printscreen)
*N_GetMaTyp() - NetWare long machine type
*N_GetSMTyp() - NetWare short machine type
*N_GetOSTyp() - NetWare os type
*N_GetOSVer() - NetWare os version
*N_IsMap() - Is a drive mapped to a NetWare Server
*N_Map() - NetWare drive map command
*N_MapRem() - NetWare map delete command
*N_Detach() - NetWare Detach from file server.
*N_LogoutFS() - Logout from a specific file server
*N_Logout() - Logout of all servers.
*N_ServName() - Return File Server Name For Drive
*N_Date() - NetWare file server date
*N_Attach() - Attach to a file server.
*N_LoginFS() - Login to a file server.
*N_IsAttach() - Return whether attached to a server.
*N_Time() - NetWare file server time
*N_GetQList() - NetWare get queue list
*N_GetGroup() - NetWare get group list
*N_GetSList() - NetWare get server list
*N_AcctList() - NetWare get user acct list
*N_GetWild() - NetWare scan bindery for wild cards
*N_IsMember() - Now accepts an optional user id to check membership for.
* N_IsEquiv() - Now accepts an optional user id to check equivalence for.
*
*
* If you have any comments, or requests for enhancements, please
* pass them along, and I will see what I can do. -George-
*
*******************************************************************
*******************************************************************
*
*
*AboutGPLIB() - Return version information for GPLIB
*CtlAltShft() - Return true if control, alt, or shift key is held down
*FileCount() - Function to return # of matching files in a directory.
*FKillAll()- Wild Card File Erase
*Flag()-Set DOS file attributes.
*Math_Chip() - Return true if a 80x87 math coprocessor is installed.
*Make_Dir() - Create directory.
*MReset() - Perform mouse reset.
*Num_Serial() - Return Number of Serial Ports
*N_AcctList() - Return list of user accounts from server.
*N_Attach() - Attach to a file server.
*N_Date() -Return File Server Date
*N_Detach() - Detach from file server
*N_DfServer() - Change default server.
*N_FlushLPT() - Flush capture of specified LPT port.
*N_FullName() - Return users full name
*N_GetGroup() - Return list of groups from server.
*N_GetMaTyp() - Get Long Machine Type
*N_GetOSTyp() - Return Operating System Type
*N_GetOSVer() - Return Operating System Version
*N_GetQList() - Return List of Queues from server.
*N_GetSList() - Return List of Servers from the file server.
*N_GetSMTyp() - Get Short Machine Type
*N_GetWild() - Get List Of all bindery objects from server.
*N_IsAttach() - Return whether attached to a server.
*N_IsEquiv()-Return Security Equivalence
*N_IsMap - Is drive mapped to a NetWare file server.
*N_IsMember()-Return Group Membership
*N_LogDate()-Return Login date
*N_LoginFS() - Login to a file server.
*N_LoginID() - Return NetWare User ID
*N_Logout() - Logout of all file servers.
*N_LogoutFS() - Logout of specified file server.
*N_LogTime()-Return Login Time
*N_Map()-Map a drive
*N_MapRem() - Remove A drive mapping
*N_NukeSta() - Clear Specified Connection Number
*N_ServerID() - Return ID number of specified server
*N_ServFrID() - Return server name from connection ID
*N_ServName() - Return file server name for a mapped drive
*N_ShellVer() - Return Shell Version
*N_StaAddr() - Return Physical station Address
*N_StaID() - Return NetWare station number.
*N_Time() - Return File Server Time
*N_VerPwd() - Verify a users password
*Rem_Dir() -Remove a directory
*SetMLimit() - Set Mouse Limits
*SetMPos() -Set Mouse Cursor Position
*ShftPrtScr() - Invoke Hardware Interrupt 5 (Shift-Printscreen)
*TrimLen()-Return Trimmed Length of a String
*UniqueName() - Return unique file name
******************************************************************
____________________________________________________________________
AboutGPLIB() - Return version information for GPLIB
Purpose
Return the current version number of GPLIB.PLB
Syntax
AboutGPLIB()
Returns
.T.
Note
This function displays the current version number of GPLIB in
a WAIT WINDOW.
____________________________________________________________________
CtlAltShft() - Return true if control, alt, or shift key is held down
Purpose
Return true if the Control, Alt or Shift key is held down.
Syntax
? CtlAltShft()
Example
This example shows how you could use CtlAltShft in a program to
hide the window when the user presses one of those keys.
define window Disp_msg from 10,10 to 20,70 double float
activate window disp_msg
?' This is a message '
do while lastkey()<>27
=inkey(.5,'H')
If CtlAltShft()
hide window disp_msg
do while CtlAltShft()
* nothing
enddo
Show Window disp_msg
Endif
enddo
_________________________________________________________________________
FKillAll()- Wild Card File Erase
Purpose
The purpose of this function is to perform a wild-card file erase.
Standard DOS wildcards '?' and '*' are supported.
Syntax
?FKillAll(
Returns
Number of files deleted.
Note
If the files you wish to deleted are flagged read-only, you must set
them to normal before calling this function.
Example
?FKillAll('*.bak') && Erase all .bak files
_______________________________________________________________________
FLAG()-Set DOS file attributes.
Purpose
To set the DOS file attribute for a file or files.
Syntax
?flag(
wildcards of '?' and '*' are supported.
flags are:
R - Read Only
H - Hidden
S - System
A - Archive
flags are in the format +R, to set that attribute bit, or -R 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
____________________________________________________________________
MATH_CHIP() - Return true if a 80x87 math coprocessor is installed.
Purpose
Return a boolean true if a math coprocessor is installed in the
executing machine.
Syntax
?Math_Chip()
Returns
.T. if math coprocessor installed.
.F. if math coprocessor not installed.
Note
This function reads the BIOS equipment list to get the result.
In my experience, this should be adequate for all needs.
If you need a routine to check the actual existence by performing
a floating point test, then I would recommend the MathChip routine
in FoxPro2 A Developer's Guide (M&T Books), chapter 16.
__________________________________________________________________________
MAKE_DIR() - Create directory.
Purpose
The purpose of this routine is to create a DOS directory.
Syntax
MAKE_DIR(
Returns
.T. if successful, .F. otherwise
Example
if .not. make_dir('C:\MyProg\Temp')
?'Unable to create directory'
else
?'Directory created'
endif
Note
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.
__________________________________________________________________________
MRESET() - Perform mouse reset.
Purpose
To reset the mouse
Syntax
MRESET()
Returns
AX register.
________________________________________________________________________
Num_Serial() - Return Number of Serial Ports
Purpose
To return the number of serial ports installed in a machine.
This can be useful in developing machine inventory programs
in FoxPro.
Syntax
?Num_serial()
Returns
Number of serial ports installed on machine.
_______________________________________________________________________
N_AcctList - Return list of user accounts from the server.
Purpose
To return an array containing all user accounts on the default server.
Syntax
N_AcctList(
C_ArrayName is the name of the array that will be created to hold
the information returned.
C_AcctSpec is an option specifier that limits the names of the
accounts returned.
C_ServerName is an optional server identifier. You can specify a
different server to get the acct list from (besides the default
server).
Returns
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.
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_AcctList('UserArr')
create cursor USERS (UserName C(48), User_OB_ID C(8))
append from Array UserArr
browse
*
* The second example finds a users mail directory
=N_AcctList('Dummy',N_LoginID())
path='F:\MAIL\'+dummy[1,2]
?path
*
* This example demonstrates getting a list of users from a different
* server. Note user of '*' as C_AcctSpec
Set library to gplib
=N_AcctList('UserArr','*','Engineering')
create cursor USERS (UserName C(48), User_OB_ID C(8))
append from Array UserArr
browse
Note
The NetWare ObjectID is the same as the users mail ID.
_______________________________________________________________________
N_Attach() - Attach to a file server.
Purpose
To attach to a NetWare file server but not login.
Syntax
N_Attach(
C_ServerName is the name of the file server to attach to.
_______________________________________________________________________
N_Date() - Return server date.
Purpose
To return the current system date from the network file server.
Syntax
N_Date()
Returns
Server date as a character string in the format MM/DD/YY. If YY
is less than 80, it is considered to be in the twenty-first century
Example
* This mythical example shows how you could implement a journaling
* system to record changes to key tables. Because the system
* date and time are retrieved directly from NetWare, they can safely
* be considered secure, and immune from tampering.
*
if updated()
select journal
replace date with ctod(N_DATE()), time with N_time(), user with;
N_LoginID, action with 'modified record', key with partno
endif
___________________________________________________________________________
N_Detach() - Detach from file server.
Purpose
To detach from a specified file server.
Syntax
N_Detach(
C_ServerName is the name of the server to detach from.
Returns
.T. if successful, .F. otherwise.
Example
if N_Detach('ENGINEERING')
?'connection to engineering server cleared'
endif
___________________________________________________________________________
N_DfServer() - Change default server
Purpose
To change the default server request packets are sent to.
Syntax
N_DfServer(
C_ServerName is the name of the server to set the default to.
Returns
Connection Number of specified server.
Example
* Display a list of users currently logged in, and their full names
* on the engineering server.
=N_DfServer("ENGINEERING")
Max_Conns=250
for loop=1 to Max_Conns
if len(N_LoginID(loop))>0
?str(loop,3), PADR(n_loginid(loop),12),padr(n_fullname(loop),40),n_logdate(loop), n_logtime(loop)
endif
endfor
___________________________________________________________________________
N_FlushLPT() - Flush specified LPT port
Purpose
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.
Syntax
N_FlushLPT([
I_PortNumber is the LPT port to flush. If no parameter is passed,
LPT1 is flushed.
Returns
NetWare result code
___________________________________________________________________________
N_FullName() - Return Users fullname
Purpose
To return the full 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.
Syntax
N_FullName([
Returns
Full name as entered in the NetWare bindery. If no full name is specified
the function returns < (OBJECT TYPE) - No Full Name >.
Example
?n_fullname(2)
Bill Smith
?N_fullname(3)
< User - No Full Name >
* Display a list of users currently logged in, and their full names
Max_Conns=250
for loop=1 to Max_Conns
if len(N_LoginID(loop))>0
?str(loop,3), PADR(n_loginid(loop),12),padr(n_fullname(loop),40),n_logdate(loop), n_logtime(loop)
endif
endfor
___________________________________________________________________________
N_GetMaTyp() - Return Long Machine Type
Purpose
The purpose of this function is to return the long machine type of
the executing station.
Syntax
N_GetMaTyp()
Note
For information concerning machine types, refer to Novell's
installation manuals.
Example
If N_GetMaTyp()='NOHARD'
?' This machine has no hard drive'
endif
___________________________________________________________________________
N_GetOSTyp() - Machines Operations system
Purpose
To return the operating system of the executing machine.
Syntax
N_GetOSTyp()
Example
?N_GetOSTyp()
MSDOS
___________________________________________________________________________
N_GetOSVer() - Return machine operating system version
Purpose
Return the operating system version of the executing machine.
Syntax
N_GetOSVer()
Example
?N_GetOSVer()
V3.31
___________________________________________________________________________
N_GetQList() - Return a list of print queues.
Purpose
To return a list of available print queues.
Syntax
N_GetQList(
C_ArrayName is the name of the array that will be created to hold
the information returned.
C_QueueSpec is an optional specifier that limits the names of the
queues returned.
C_ServerName is an optional specifier that tells the routine what
server you wish to get a queue list from.
Returns
Number of queues found, and a two dimensional array where column
1 is the Queue Names, and column 2 is the NetWare Object ID
assigned to that Queue.
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_GetQList('UserArr')
create cursor Queues (QueueName C(48), Q_Id C(8))
append from Array UserArr
browse
Note
The object ID returned by this procedure corresponds to the queue
directory in the SYS:SYSTEM directory.
___________________________________________________________________________
N_GetSList() - Return a list of servers.
Purpose
To return a list of available servers.
Syntax
N_GetSList(
C_ArrayName is the name of the array that will be created to hold
the information returned.
Returns
Number of servers found, and a one dimensional array where
column 1 is the Server Names,
Example
* The following example builds an array of all users on the
* server, and performs a browse of them.
Set library to gplib
=N_GetSList('UserArr')
create cursor Servers (ServerName C(48))
append from Array UserArr
browse
___________________________________________________________________________
N_GetSMTyp() - Return Short Machine Type
Purpose
The purpose of this function is to return the short machine type of
the executing station.
Syntax
N_GetSMTyp()
Note
For information concerning machine types, refer to Novell's
installation manuals.
Example
?N_GetSMTyp()
IBM
___________________________________________________________________________
N_GetWild - Return Array listing all objects in bindery.
Purpose
To return an array containing a list of all objects in the bindery.
Syntax
N_GetWild(
C_ArrayName is the name of the array to return the information to.
C_ObjectSpec is an optional specifier that limits objects returned.
C_ServerName is an optional specifier that permits reading the
binder of a server besides the default server.
Returns
The number of matches in the bindery. Creates a two dimensional array
that contains the Object Name, Object ID, and the Object Type as a
hexidecimal string.
Object Type meanings:
0000h-Unknown0008h-Archive Queue
0001h-User0009h-Archive Server
0002h-User Group000Ah-Job Queue
0003h-Print Queue000Bh-Administration
0004h-File Server0024h-Remote Bridge Server
0005h-Job Server0047h-Advertising Print Server
0006h-Gateway8000h-Reserved up to 8000h
0007h-Print ServerFFFFh-Wild
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.
Example
Set library to gplib
?N_getwild('ObArray','*','Engineering')
create cursor ObArray (ObName C(48), OB_ID C(8), OB_TYPE C(4))
append from array ObArray
index on ob_type tag ob_type
browse
___________________________________________________________________________
N_IsAttach() - Return whether attached to a file server.
Purpose
To return whether a workstation is attached to the specified file
server.
Syntax
N_IsAttach(
C_ServerName is the server name to check.
Returns
.T. if attached, .F. otherwise.
Example
?N_IsAttach("ENGINEERING")
.T.
___________________________________________________________________________
N_IsEquiv()-Return Security Equivalence
Purpose
The purpose of this function is to return true if the person on the
executing machine is equivalent to the specified user.
Syntax
N_IsEquiv(
for. If ommitted, it defaults to the person currently logged in.
Returns
.T. if user is equivalent to
Example
If .not. N_IsEquiv('Supervisor')
WAIT WINDOW 'You must be a supervisor equivalent to run this program!'
CANCEL
endif
________________________________________________________________________
N_IsMap() - Return whether a drive is mapped.
Purpose
To return whether or not a drive letter is mapped to a NetWare file
server.
Syntax
N_IsMap(
C_DriveLetter is the drive letter to check
Returns
.T. if drive is mapped, .F. otherwise.
Example
if .not. N_IsMap('M')
N_Map("M","SYS:GROUP\PAYROLL")
endif
________________________________________________________________________
N_IsMember()-Return Group Membership
Purpose
The purpose of this function is to return true if the person on the
executing machine is a member of a specified group.
Syntax
N_IsMember(
for. If ommitted, it defaults to the person currently logged in.
Returns
.T. if user is member of specified group, .F. otherwise.
Example
if .not. N_IsMember('HR')
WAIT WINDOW 'Error! You are not authorized to execute this program!'
CANCEL
endif
_______________________________________________________________________
N_LogDate() - Get a workstations login date
Purpose
Returns the login date of the specified work station. If no workstation
is specified, it returns the login date of the current workstation.
Syntax
N_LogDate([
Returns
Login Date as a character string.
Example
For LoopVar= 1 to 250
if (Date()-ctod(N_LogDate(LoopVar))) > 1
? N_LoginID(LoopVar)+' Logged in at '+N_LogDate(LoopVar)+;
' and has not logged out as of : '+dtoc(date())
EndFor
______________________________________________________________________
N_LoginFS() - Login to file server.
Purpose
To Login a station into a file server.
Syntax
N_LoginFS(
C_ServerName is the servers name.
C_LoginID is the login ID to use.
C_Password is the password for the login ID specified.
Returns
A numeric code:
0-Successful
197-Intruder detection activated
252-Unknown file server
255-No Response From Server
Example
set talk off
Set library to gplib
=N_GetSList('SLIST')
clear
store space(48) to userid, pword
&& Note: password can actually be 128
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_Loginfs(s_name,userid,pword)
if result =0
wait window 'Successfully logged in to file server : '+s_name
else
wait window 'Login FAILED. Result code was :'+ltrim(str(result))
endif
_______________________________________________________________________
N_LoginID() - Return NetWare User ID
Purpose
To return the NetWare user id of the a station.
Syntax
N_LoginID()&& Return User ID of Current Station
N_LoginID(
&& at StationNumber
_______________________________________________________________________
N_LogTime() - Get a workstations login time
Purpose
Returns the login date of the specified work station. If no workstation
is specified, it returns the login date of the current workstation.
Syntax
N_LogTime([
Returns
Login Time as a character string.
Example
For LoopVar= 1 to 250
if (Date()-ctod(N_LogDate(LoopVar))) > 1
?N_LoginID(LoopVar)+' Logged in at '+N_LogDate(LoopVar)+;
N_LogTime(LoopVar)+' and has not logged out as of : '+;
dtoc(date())
EndFor
___________________________________________________________________________
N_Map() - Map a drive
Purpose
The purpose of this function is to map a drive on the network.
Syntax
N_Map(
C_Letter is the drive letter.
C_Path is the path in the form '
C_ServerName is the optional name of the file server to
map the drive on.
Returns
0-Success
152-Volume Does Not Exist
156-Path does not exist
Example
?n_map('m','sys:public')
0
?N_Map('m','SYS:DBDATA','ENGINEERING')
&& Map drive m to SYS:DBDATA on the ENGINEERING server.
___________________________________________________________________________
N_MapRem() - Remove a drive mapping.
Purpose
To remove a network drive mapping.
Syntax
N_MapRem(
C_Letter is the drive letter to delete.
Returns
0-Success
155-Bad Directory Handle
___________________________________________________________________________
N_NukeSta() - Clear Specified station
Purpose
The purpose of this function is to clear the specified network station
number.
Syntax
N_NukeSta(
I_StationNumber is the station number to clear.
Note
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 (I did this folks, believe me). This command
was included, because there was some interest on the FoxForum in
such a command.
Example
* Clear all users logged in as PRODUCTION, PIC, or INVENTORY 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.
*
for loop= 1 to 250
if N_LoginID()$' PRODUCTION PIC INVENTORY '
=N_NukeSta(Loop)
endif
endfor
___________________________________________________________________________
N_ServerID() - Return server connection number.
Purpose
The purpose of this function is to return the connection number of
the specified file server.
Syntax
N_ServerID(
C_ServerName is the name of the server to get the connection
number for.
Returns
Integer connection number (1 to 8) of the specified server.
___________________________________________________________________________
N_ServFrID() - Return server name.
Purpose
To return the name of the server from the specified connection number.
Syntax
N_ServFrID([
I_ConnectionNumber is the connection number of the server to
get. If the parameter is ommitted, the name of the default
file server is returned.
Returns
Name of specified server, or default server.
Example
?N_ServFrID()
ACCTG
?N_ServFrID(2)
ENGINEERING
___________________________________________________________________________
N_ServName() - Return Server name.
Purpose
To return the name of the file server that a drive is mapped to.
Syntax
N_ServName(
C_DriveLetter is the drive letter to check.
Returns
Server name as character string.
Example
?N_ServName('m')
ENGINEERING
___________________________________________________________________________
N_ShellVer() - Return Shell Version
Purpose
The purpose of this function is to return the NetWare Shell version.
Syntax
N_ShellVer()
Returns
The NetWare Shell version in the format
where Shell Type is:N for NETx
E for EMSNETx
X for XMSNETx
___________________________________________________________________________
N_StaAddr() - Return Physical station Address
Purpose
To return the 12 digit physical node address of the computer
the program is running on.
Syntax
N_STAADDR()
Returns
12 digit physical node address in hexadecimal
Example
?N_StaAddr()
0000C029512D
___________________________________________________________________________
N_StaID() - Return NetWare station number.
Purpose
To return the NetWare Station Number for the current machine.
Syntax
N_StaID()
Returns
The NetWare station number as an integer.
Example
ScratchFile='$T'+alltrim(str(N_StaID))+'TEMP.FIL'
copy structure to (ScratchFile)
use (scratchFile) ALIAS Scratch
* Perform some kind of processing
use
erase (scratchFile)
_______________________________________________________________________
N_Time() - Return File Server Time.
Purpose
To return the current system time from the file server.
Syntax
N_Time()
Example
* This mythical example shows how you could implement a journaling
* system to record changes to key tables. Because the system
* date and time are retrieved directly from NetWare, they can safely
* be considered secure, and immune from tampering.
*
if updated()
select journal
replace date with ctod(N_DATE()), time with N_time(), user with;
N_LoginID(), action with 'modified record', key with partno
endif
_______________________________________________________________________
N_VerPwd() - Verify a users password
Purpose
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.
Syntax
N_VerPwd(
Returns
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)
Note
If your network has intruder detection lockout turned on, and a
call is made to this routine unsuccessfully
for that user will be locked.
Example
@5,5 Say 'Please enter password for entry to payroll files ' Get PassWord
Read
PassWord=Alltrim(PassWord)
if N_VerPwd(PassWord)<>0
WAIT WINDOW 'Error Access Denied!'
CANCEL
endif
* Main application for payroll
_______________________________________________________________________
REM_DIR() -Remove a directory
Purpose
Remove a DOS directory
Syntax
?Rem_Dir(
Returns
.T. if successful, .F. otherwise.
Example
?REM_DIR('C:\TEMP\TEMP1')
.T.
Notes
Normal DOS limitations about removing directories also apply to this
function. I.E. the directory you remove must be empty.
__________________________________________________________________________
SetMLimit() - Set Mouse Limits
Purpose
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. Granted a MODAL read is effectively the same, I just think
users might get the idea more if they couldn't move the cursor
outside the window.
Syntax
?SetMLimit(
Where:
I_Y1 is the upper Y Limit
I_X1 is the left X Limit
I_Y2 is the lower Y Limit
I_X2 is the right x Limit
Returns
.T.
________________________________________________________________________
SETMPOS() -Set Mouse Cursor Position
Purpose
Set the mouse cursor position on the screen.
Syntax
?SETMPOS(
Where
I_Y1 is the Y axis coordinate
I_X1 is the X axis cooardinate
Example
* Issue Push Button @ Says
=SetMPos(10,10)
Read && The mouse character is now on the OK button
Returns
.T.
______________________________________________________________________
ShftPrtScr() - Invoke hardeare interrupt 5 to perform a Shift-Printscreen
Purpose
Invoke hardeare interrupt 5 to perform a Shift-Printscreen
Syntax
ShftPrtScr()
Returns
.T. always.
______________________________________________________________________
TRIMLEN()-Return Trimmed Length of a String
Purpose
The purpose of this function is to return the LEN of an
ALLTRIM'd string. It is functionally equivalent to
LEN(ALLTRIM(string)).
Syntax
TrimLen(
Example
if TrimLen(MyUserInput)=0
return
else
* process input
endif
_____________________________________________________________________
UniqueName() - Return unique file name
Purpose
The purpose of this function is to return a unique file name. This
function requires that the machine be operating on a Novell Network.
Syntax
UniqueName()
Returns
A unique file name which consists of:
'$T' + Network Station Number in Hex + a sequential number starting
at 1, and returned in hexadecimal.
Notes
Fox's SYS(3) purports to return a unique file name, but it actually
returns a random file name. I have had a program die in a training
room because 7 people on 7 identical machines tried to run a program.
Because this function incorporates the NetWare station number in it's
result, it is a guaranteed unique file name.
Example
Use MyFile
Scratch=UniqueName()
Copy Structure to (Scratch)
use (scratch) exclusive alias scratch
* perform processing
use
erase (scratch+'.dbf')
December 15, 2017
Add comments