home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / KLOCK2.ZIP / KEYLOCKS.DOC < prev    next >
Text File  |  1992-07-17  |  36KB  |  860 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.            General Information on KeyLocks II, Versions 2.00 and 2.00D
  11.  
  12.  
  13.  
  14.             (c) Copyright 1992 Yankee Software, All rights reserved.
  15.  
  16.  
  17.  
  18.           Notices
  19.  
  20.               KeyLocks II is offered in both a general release  version
  21.           and  a  demonstration  version  under  a  license  agreement. 
  22.           Examine the license agreement for the terms and conditions of
  23.           the license. 
  24.  
  25.               OS/2  and Presentation Manager are registered  trademarks
  26.           of International Business Machines Corporation.  Windows is a
  27.           registered trademark of Microsoft Corporation.
  28.  
  29.               Permission   is  granted  to  quote  portions   of   this
  30.           documentation.
  31.  
  32.  
  33.  
  34.           Introduction
  35.  
  36.               KeyLocks II allows the user to configure the state of the
  37.           three shift lock keys, num-lock, caps-lock,  and scroll-lock,
  38.           from  the command line,  from a batch file,  or  by  invoking
  39.           KeyLocks  II  from  a PM program entry.   KeyLocks  II  works
  40.           equally  well under real DOS, under OS/2's emulation of  DOS,
  41.           under  OS/2 Virtual Boot Machines running a specific  version
  42.           of DOS,  under OS/2 full-screen sessions,  and under the OS/2
  43.           Presentation  Manager.    In  order  to  work  in  all  these
  44.           environments,  it comes as two programs.  KeyLocks II for DOS
  45.           and  OS/2  full-screen  (KEYLOCKS.EXE), and  KeyLocks  II  PM
  46.           (KEYLPM.EXE).  
  47.  
  48.               The program is easy to use.  It accepts and acts on seven
  49.           parameters:
  50.  
  51.                       NUMLOCK
  52.                       NONUMLOCK
  53.                       CAPSLOCK
  54.                       NOCAPSLOCK
  55.                       SCROLLLOCK
  56.                       NOSCROLLLOCK
  57.                       BRIEF
  58.  
  59.               (It  makes  no different whether the  parameters  are
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.               written in upper or lower case letters.)
  72.  
  73.               The   purposes   of   the  first   six   parameters   are
  74.           self-explanatory.   NUMLOCK turns on the num-lock key.   Most
  75.           keyboards  have a combination cursor/numeric key pad  off  to
  76.           the  right  of the main set of keys.   When num-lock  is  on,
  77.           those  keys  produce numeric input for the  program  that  is
  78.           running  and has the keyboard focus.   When num-lock is  off,
  79.           cursor  commands and other functions are sent  instead.   The
  80.           user  can change this state by simply pressing  the  num-lock
  81.           key.   However, in many cases, it is convenient to be able to
  82.           configure  a  known  starting point that  will  be  familiar,
  83.           invariant,  and uniform.  KeyLocks II provides the ability to
  84.           configure  each of the shift lock keys as either on  or  off. 
  85.           In addition, it will leave unmodified the existing state of a
  86.           shift  lock key if neither the turn-on nor turnoff  parameter
  87.           is supplied.  
  88.  
  89.               When  no  parameters  are supplied  to  KeyLocks  II,  it
  90.           assumes  that  the person running it is unfamiliar  with  the
  91.           program and would like some helpful information.  As a result
  92.           it  displays a couple of screens of helpful information.   It
  93.           also requires the user to hit a key to continue.   The  BRIEF
  94.           parameter  turns  off  or reduces  this  initial  display  of
  95.           information,  and also insures that the user is not  prompted
  96.           to hit a key to continue.  
  97.  
  98.  
  99.  
  100.           How to supply parameters to KeyLocks II on the command line
  101.  
  102.               The  parameters that control KeyLocks II can be  supplied
  103.           as command line parameters.   There are basically three  ways
  104.           to  supply  command  line parameters:  interactively  at  the
  105.           command line, on the line that invokes the program in a batch
  106.           file,  or in the parameters field of the Desktop Manager's or
  107.           Workplace Shell's program entry.  
  108.  
  109.               When  typing at the command line,  the parameters  follow
  110.           the  name  of the program and come before  pressing  carriage
  111.           return  (the ENTER key).   For example, if you are at  a  DOS
  112.           prompt:
  113.  
  114.                       C:>
  115.  
  116.           You can type
  117.  
  118.                       keylocks brief capslock
  119.  
  120.           followed by a carriage return (ENTER key) to invoke keylocks,
  121.           tell it to be brief in its user output, and turn on the
  122.           capslock key.  This assumes, of course, that DOS can find the
  123.           program KEYLOCKS.EXE somewhere in the path.  For more
  124.           information on DOS and OS/2 paths, consult your DOS or OS/2
  125.           command reference.  
  126.  
  127.  
  128.                                       - 2 -
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.               Batch files are text (ASCII) files that contain a  number
  139.           of  lines each of which is processed in a manner  similar  to
  140.           the way it would be processed if a user had typed them at the
  141.           keyboard.   Batch files have extensions of BAT in the case of
  142.           DOS and CMD in the case of OS/2.   Using a suitable editor or
  143.           word  processor,  you can enter a line in a batch  file  that
  144.           will  invoke KeyLocks II with the parameters that you  desire
  145.           when the batch file is run.  For example,  in the case of the
  146.           STARTUP.CMD batch file which is run automatically by the OS/2
  147.           at system start-up, the line
  148.  
  149.                       start c:\mydir\keylpm brief numlock capslock
  150.  
  151.           will invoke KeyLocks II PM at system start-up and turn on the
  152.           num-lock and caps-lock keys in the PM session.  (The example
  153.           assumes that the program KEYLPM.EXE has been installed in the
  154.           "C:\MYDIR" directory.)  For more information on batch files,
  155.           consult your DOS or OS/2 command reference.
  156.  
  157.               Finally,  in  the case of the Presentation  Manager,  the
  158.           program entry has a field where you can enter the  parameters
  159.           to  be passed to KeyLocks II PM.   The steps to do  this  are
  160.           explained in the two sections, "Continuing Installation under
  161.           the Desktop Manager"  and "Continuing Installation under  the
  162.           Workplace Shell" below.  
  163.  
  164.  
  165.  
  166.           How to pass parameters to KeyLocks II through an environment
  167.           variable
  168.  
  169.               Parameters  may  be passed to KeyLocks II by  way  of  an
  170.           environment  variable  named  "KEYLOCKS".    To  define   the
  171.           environment  variable,   type  the  following  line  in  your
  172.           CONFIG.SYS (OS/2) or AUTOEXEC.BAT (DOS) file:
  173.  
  174.                       set KEYLOCKS=brief numlock capslock
  175.  
  176.           Note:  use the parameters that suit your needs.   Also  note:
  177.           the environment variable's name "KEYLOCKS"  must be in either
  178.           all upper case or all lower case letters.  Finally note: OS/2
  179.           does not maintain a common environment for OS/2 and DOS.  The
  180.           DOS environment must be set in the AUTOEXEC.BAT file (or some
  181.           similar startup file),  while the mother environment for OS/2
  182.           (which  is inherited by all OS/2 sessions) can be set in  the
  183.           CONFIG.SYS file.
  184.  
  185.               To pass parameters through an environment variable, first
  186.           set the KEYLOCKS environment variable to the parameters  that
  187.           you wish to use as explained above.   Then invoke KeyLocks II
  188.           without any command line parameters.  When the program starts
  189.           up,  it first looks for its parameters from the command line,
  190.           if it does not find any parameters there,  it then looks  for
  191.           its parameters from the environment variable.
  192.  
  193.  
  194.                                       - 3 -
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           Special considerations for older versions of DOS
  207.  
  208.               KeyLocks  II  may  not work properly  with  DOS  versions
  209.           earlier than DOS 3.3.  
  210.  
  211.  
  212.  
  213.           Special considerations for OS/2
  214.  
  215.               OS/2  allows the user to invoke many different  sessions. 
  216.           In  general,  the OS/2 keyboard driver maintains a  different
  217.           shift lock state for each session.   This means that you  may
  218.           have  the num-lock key on and the caps-lock key off in a  DOS
  219.           session,  while in an OS/2 full-screen session,  you have the
  220.           num-lock key off and the caps-lock key on.  Furthermore,  you
  221.           may  have another OS/2 full-screen session where neither  the
  222.           num-lock nor the caps-lock key is turned on.  And so on.
  223.  
  224.               For  this  reason,  KeyLocks II works  on  a  session  by
  225.           session basis under OS/2.   To configure the shift lock  keys
  226.           in each session started, run a batch or command file when the
  227.           session is started.  (See the OS/2 command reference for more
  228.           information on how to do this.)  Within this batch or command
  229.           file,   you  invoke  KEYLOCKS  or  KEYLPM  to  configure  the
  230.           sessions.   As explained above,  you may use  an  environment
  231.           variable  to  pass the parameters to KeyLocks II  instead  of
  232.           passing them on the command line.
  233.  
  234.  
  235.  
  236.           Special considerations for the Presentation Manager Session
  237.  
  238.               The  PM  session  offers some peculiar  challenges  to  a
  239.           program  like KeyLocks II.  The Presentation Manager  retains
  240.           in  memory the state of the shift lock keys which is  updated
  241.           whenever the user presses a shift lock key.   This memory  is
  242.           not  updated when a program changes the states of  the  shift
  243.           lock  keys.   The Presentation Manager allows  a  program  to
  244.           change this state, but it never forgets the state that was in
  245.           effect after the user's last action.  The problem arises when
  246.           the user switches off to another full-screen session and then
  247.           comes back to the Presentation Manager.   At this point,  the
  248.           Presentation  Manager  restores the state of  the  shift-lock
  249.           keys  that it has remembered.  This restoration is likely  to
  250.           undo the changes made by a program like KeyLocks II in the PM
  251.           session.   Worse yet,  the Presentation Manager fails to do a
  252.           good  job  when it restores its remembered state,  and  as  a
  253.           result  unusual  situations can arise,  such  as  having  the
  254.           num-lock  key on but the keyboard's num-lock light  off.   To
  255.           compensate  for  the Presentation  Manager's  mucking  about,
  256.           KeyLocks II PM remains resident after its first invocation to
  257.           clean  up behind the Presentation Manager when it comes  into
  258.  
  259.  
  260.                                       - 4 -
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.           the  foreground.   It performs the cleanup by  restoring  the
  270.           shift lock keys to the state that was last configured  either
  271.           by a program that has used the KeyLocks II Server application
  272.           programming interface,  or by the user pressing a shift  lock
  273.           key.   If at some point, you decide to terminate the resident
  274.           KeyLocks II PM program, it will restore the keys to the state
  275.           that agrees with the Presentation Manager's memory,  so  that
  276.           no unusual situations arise.
  277.  
  278.  
  279.  
  280.           Special considerations for Windows sessions under OS/2
  281.  
  282.               If  you invoke KeyLocks II from your  AUTOEXEC.BAT  file,
  283.           then  when  you  start any Windows session  under  OS/2,  the
  284.           KeyLocks  setting used in the AUOTEXEC.BAT will take  effect. 
  285.           To  configure  different Windows sessions  to  configure  the
  286.           shift lock keys differently in different sessions,  you  will
  287.           need  to  make use of custom batch files  to  configure  each
  288.           session.
  289.  
  290.  
  291.  
  292.           Demonstration and General Release versions
  293.  
  294.               KeyLocks  II is available in two versions.   The  general
  295.           release  version  is  offered for sale  under  license.   The
  296.           demonstration version is free and also subject to a  license. 
  297.           There  are  only two major differences  between  the  general
  298.           release version and the demonstration version.
  299.  
  300.               The  first  major difference is  that  the  demonstration
  301.           version  has  a  "nuisance  feature"   whose  purpose  is  to
  302.           encourage you to purchase the real thing after you have had a
  303.           chance  to  test  the  demonstration  version  and  determine
  304.           whether  KeyLocks II is useful and meets  your  requirements. 
  305.           As   explained  above,   the  BRIEF  parameter  shortens   or
  306.           suppresses  explanatory  screens and starts  up  the  program
  307.           without requesting user input.  In the demonstration version,
  308.           the  BRIEF parameter is filtered through a  random  function. 
  309.           About  25%  of the time,  the random function will  fail  the
  310.           BRIEF parameter, and when this happens, the program acts just
  311.           as  if the BRIEF parameter was not present.   In the  general
  312.           release version, the BRIEF parameter is acted on directly and
  313.           not filtered through a random function.
  314.  
  315.               A second major difference between the general release
  316.           version and the demonstration version is that the dialog box
  317.           in the demonstration version of KeyLocks II PM is system
  318.           modal, meaning that when it comes up, you must respond to it 
  319.           before doing anything else.  As with the random filtering of
  320.           the BRIEF parameter, having a system modal dialog box is a
  321.           nuisance.  In the general release version of the program, the
  322.           dialog boxes of KeyLocks II PM are not system modal.  
  323.  
  324.  
  325.  
  326.                                       - 5 -
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.               The  minor differences between the two versions are  just
  336.           textual differences in the display screens or dialog boxes.
  337.  
  338.  
  339.  
  340.           Conceptual Overview of the Software Architecture
  341.  
  342.               KeyLocks  II consists of four program files.   The  first
  343.           program  file (KEYLOCKS.EXE) is KeyLocks II for DOS and  OS/2
  344.           full-screen.   This  is a dual-mode program that  runs  under
  345.           both real DOS,  OS/2 emulated DOS, OS/2 Virtual Boot Machines
  346.           running  specific  versions  of  DOS,  and  OS/2  full-screen
  347.           sessions.
  348.  
  349.               The remaining three files, KEYLPM.EXE,  KEYLOCK.DLL,  and
  350.           SNOTICE.SYS are the components of KeyLocks II PM.  
  351.  
  352.               KEYLPM.EXE   is,   in   essence,  the   PM   version   of
  353.           KEYLOCKS.EXE.   However, because it is necessary for KeyLocks
  354.           II PM to monitor the Presentation Manager and clean up behind
  355.           it  whenever  it  comes  into  the  foreground,   the   first
  356.           invocation  of KEYLPM.EXE remains resident to  perform  these
  357.           tasks.  
  358.  
  359.               KEYLOCK.DLL is the KeyLocks II Server.   The KeyLocks  II
  360.           Sever  provides services to two classes of  clients:  private
  361.           clients   and  public  clients.   The  first  invocation   of
  362.           KEYLPM.EXE  is  the only private client of  the  KeyLocks  II
  363.           Server.  KEYLPM.EXE initializes the KeyLocks II Server,  uses
  364.           it to set the keys,  and tells it when to clean up behind the
  365.           shell.  If this first invocation of KEYLPM.EXE is terminated,
  366.           the KeyLocks II Server is de-initialized, and the keyboard is
  367.           restored  to  a  state  that is  compatible  with  the  state
  368.           remembered by the Presentation Manager.  Any PM or OS/2  text
  369.           window  program  may be a public client of  the  KeyLocks  II
  370.           Server.   Public clients tell the KeyLocks II Server  how  to
  371.           set  the shift-lock keys in the PM session.   Public  clients
  372.           can do this only if KEYLPM.EXE is running and has initialized
  373.           the server.   See below for more information on the  KeyLocks
  374.           II Sever application programming interface (API).
  375.  
  376.               SNOTICE.SYS is a device driver that is used by the  first
  377.           invocation of KEYLPM.EXE to obtain notice of the movement  of
  378.           the  Presentation Manager into the foreground.   Since it  is
  379.           necessary  to reset the desired state of the shift lock  keys
  380.           after the PM shell has moved into the foreground, SNOTICE.SYS
  381.           provides  efficient and timely notice of this  occurrence  to
  382.           KEYLPM.  SNOTICE.SYS is a device driver whose sole purpose is
  383.           to  pass back various kinds of notices of session changes  to
  384.           the  caller.   The caller may be a DOS or OS/2 program.   The
  385.           programming  API  to this device driver  is  not  documented. 
  386.           Anyone  who is interested in using this device driver with  a
  387.           program other than KeyLocks II PM should contact the company.
  388.  
  389.  
  390.  
  391.  
  392.                                       - 6 -
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.           Special considerations when installing the general release
  403.           version of the software on a system where the demonstration
  404.           version is installed
  405.  
  406.               Shut down KeyLocks II PM if you have it running, and copy
  407.           the  files  as instructed to the same directories  where  you
  408.           installed  the demonstration version.  (You will  be  copying
  409.           new files over old files.)
  410.  
  411.  
  412.  
  413.           Installation on DOS or OS/2 Systems
  414.  
  415.               KeyLocks  II consists of four program files.   The  first
  416.           program  file (KEYLOCKS.EXE) is KeyLocks II for DOS and  OS/2
  417.           full-screen.   Copy this file to any convenient directory  on
  418.           your hard disk or boot floppy.   In the examples that follow,
  419.           we   have  assumed  that  you  are  using  the   subdirectory
  420.           "C:\MYDIR", but you may use any subdirectory on any drive, as
  421.           you  wish.   Just remember to substitute your name  for  ours
  422.           when following the examples.
  423.  
  424.               Note:  normally  this would be a  directory  that  is
  425.               mentioned in your PATH command for the sessions  that
  426.               you  intend to invoke it from.   If this is  not  the
  427.               case,  then  you must either explicitly tell  DOS  or
  428.               OS/2  the  path name of the directory  that  you  are
  429.               using, so that it know where to find the program when
  430.               you  invoke it,  or you must make this directory  the
  431.               default directory before you invoke KEYLOCKS.  
  432.  
  433.               For  DOS only systems and for use of KeyLocks II  in  the
  434.           DOS  sessions  of OS/2,  you will likely want  to  alter  the
  435.           AUTOEXEC.BAT file by adding a line similar to the following:
  436.  
  437.                       KEYLOCKS BRIEF CAPSLOCK
  438.  
  439.           Note: use the parameters that are suitable to your needs.  If
  440.           you are using parameters supplied by setting the environment
  441.           variable KEYLOCKS, do not provide parameters in the
  442.           AUTOEXEC.BAT.  If you installed KEYLOCKS.EXE in a directory
  443.           that is not listed in the current PATH or in the default
  444.           directory, you must tell DOS where to find the program by
  445.           giving a complete description of its location, as in the
  446.           following example:
  447.  
  448.                       C:\mydir\keylocks brief capslock
  449.  
  450.               This  completes installation for using KeyLocks  II  with
  451.           the DOS operating system.  
  452.  
  453.               If you are installing KeyLocks II on an OS/2 system,  and
  454.           you  wish  to use KeyLocks II to configure  OS/2  full-screen
  455.           sessions,  you will want to create or alter the  batch  files
  456.  
  457.  
  458.                                       - 7 -
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.           that are used to start the OS/2 sessions.   Edit these  batch
  468.           or  command files (which have CMD extensions) and insert  the
  469.           line to invoke KeyLocks II with the parameters that you want. 
  470.           For example add the line:
  471.  
  472.                   C:\mydir\keylocks numlock noscrolllock capslock brief
  473.  
  474.           to invoke the copy of KEYLOCKS.EXE stored in the C:\MYDIR,
  475.           turn on the num-lock key, turn off the scroll-lock key, and
  476.           turn on the caps-lock key.  Again: if you wish to use the
  477.           parameters supplied by the environment variable KEYLOCKS, do
  478.           not supply command line parameters.  For more information on
  479.           how to run an assigned batch file when starting a session,
  480.           consult your OS/2 command reference.  In particular see the
  481.           documentation on "CMD" and "START".
  482.  
  483.               If you are installing KeyLocks II on an OS/2 system,  and
  484.           wish  to configure the shift lock keys for  the  Presentation
  485.           Manager session, continue with the steps below.
  486.  
  487.               As  explained  above,  KeyLocks II PM has  three  program
  488.           files.   Copy the two files KEYLPM.EXE and SNOTICE.SYS to any
  489.           desired  subdirectory.   For  the  examples  below,  we  have
  490.           assumed  that  you are copying these files to  the  following
  491.           subdirectory.
  492.  
  493.                       C:\MYDIR
  494.  
  495.           When you are following the directions below, substitute the
  496.           drive letter and full pathname that you have chosen.
  497.  
  498.               Now look for a directory named 
  499.  
  500.                       \OS2\DLL
  501.  
  502.           This is often on the C drive, but it may be on a different
  503.           drive in your case.  Copy KEYLOCK.DLL to this directory.
  504.  
  505.               On the root directory of your boot disk,  you will find a
  506.           file named CONFIG.SYS.   Make a copy of this file to a backup
  507.           name,  then using a text editor, or a word processor that can
  508.           input and output ASCII files (and which will not word wrap or
  509.           truncate long lines!) edit CONFIG.SYS file. 
  510.  
  511.               You need to add one line to the CONFIG.SYS file.   Go  to
  512.           the end of the file and add the line:
  513.  
  514.                       DEVICE=C:\MYDIR\SNOTICE.SYS
  515.  
  516.               Now save the file CONFIG.SYS to disk.   Note:  if you are
  517.           using  a word processor,  the file must be saved as an  ASCII
  518.           file.   A  text  editor normally saves all of  its  files  as
  519.           ASCII.
  520.  
  521.               To  invoke KeyLocks II PM automatically when starting  up
  522.  
  523.  
  524.                                       - 8 -
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.           the system, there are two strategies that will work.  For the
  534.           first method,  you alter or create a STARTUP.CMD file on  the
  535.           root directory of the boot drive.  This file is automatically
  536.           run  by the system upon OS/2 start-up.   Alter or create  the
  537.           file by adding the following line with a suitable text editor
  538.           or wordprocessor:
  539.  
  540.                       START C:\MYDIR\KEYLPM BRIEF NUMLOCK CAPSLOCK
  541.  
  542.           (Use the parameters that suit you, or no parameters at all if
  543.           you are using the environment variable.)  If you have
  544.           implemented this strategy, the installation is now complete. 
  545.           Shutdown and reboot your machine to make the changes you have
  546.           made take effect.
  547.  
  548.               The second strategy involves creating a program entry for
  549.           KeyLocks II PM in the Desktop Manager (OS/2 1.3) or Workplace
  550.           Shell  (OS/2  2.0).   The program entry is  then  marked  for
  551.           automatic start-up.   To implement this strategy,  follow the
  552.           instruction  given  in one of the two  immediately  following
  553.           sections,   "Continuing  the  installation  on  the   Desktop
  554.           Manager"  or  "Continuing the installation on  the  Workplace
  555.           Shell".
  556.  
  557.  
  558.  
  559.           Continuing the installation on the Desktop Manager (OS/2 1.x)
  560.  
  561.               Go to the Desktop Manager.  Select the group to which you
  562.           want  to  add  the  KeyLock  II  PM  program  entry.   Select
  563.           Program-->New.  Fill out the text boxes as follows:
  564.  
  565.                   Program title: KeyLocks II PM
  566.                   Path and file name: C:\MYDIR\KEYLPM.EXE
  567.                   Parameters: BRIEF NUMLOCK
  568.                   Working directory:
  569.  
  570.               On the Program Type list box, click on the down arrow  to
  571.           its right,  and select Presentation Manager.  If you want the
  572.           program  to run when the system is started (as  you  probably
  573.           do),  click on the Options button.  Now go to the "Open  when
  574.           system is started"  selection box and click on it.   Click on
  575.           the  OK  button  and  on  the  Add  button.   To  change  the
  576.           parameters or configuration of this program entry, select the
  577.           entry  and  then select from the  menu  Program-->Properties. 
  578.           Make the changes then click on the Change button.
  579.  
  580.               The   installation  of  the  program  is  now   complete. 
  581.           Shutdown and reboot the machine to make the changes that  you
  582.           have made take effect.   (If you invoke KeyLocks II PM before
  583.           you  shut  down and reboot,  the program will give  an  error
  584.           message saying that it is unable to locate the device driver. 
  585.           This  is  because  device drivers are loaded  only  when  the
  586.           system is started.)
  587.  
  588.  
  589.  
  590.                                       - 9 -
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.           Continuing the installation on the Workplace Shell (OS/2 2.x)
  602.  
  603.               Open  the Startup folder located in your  System  folder. 
  604.           Open  the  Templates  folder,  and  select  the  icon  marked
  605.           "Program".   Holding down the right mouse button,  drag  this
  606.           icon over to the startup folder.   This operation will create
  607.           a  new blank program entry that you will now configure.   The
  608.           settings  for  this  program  entry  will  automatically   be
  609.           displayed  for  you.   On  the Program  page,  fill  out  the
  610.           following fields:
  611.  
  612.                   Path and file name: C:\MYDIR\KEYLPM.EXE
  613.                   Parameters: BRIEF ... add other parameters here
  614.  
  615.               Now  click  on  the General page tab  and  fill  out  the
  616.           following field:
  617.  
  618.                   Title: KeyLocks II PM
  619.  
  620.               Now double click on the very small icon in the upper left
  621.           corner of the Program settings window.   This will close  the
  622.           Program settings window.
  623.  
  624.               The   installation  of  the  program  is  now   complete. 
  625.           Shutdown and reboot the machine to make the changes that  you
  626.           have made take effect.   (If you invoke KeyLocks II PM before
  627.           you  shut  down and reboot,  the program will give  an  error
  628.           message saying that it is unable to locate the device driver. 
  629.           This  is  because  device drivers are loaded  only  when  the
  630.           system is started.)
  631.  
  632.  
  633.  
  634.           API for KeyLocks II Server
  635.  
  636.               This  section  of  the  documentation  is  intended   for
  637.           programmers.  
  638.  
  639.               Any  OS/2  PM,   or  OS/2  text  window   (WINCOMPATIBLE)
  640.           application  can  call the KeyLocks II Server to  change  the
  641.           state  of  the  shift lock keys in  the  PM  session.   (OS/2
  642.           full-screen programs may also call the KeyLocks II Server  to
  643.           change  the states of the shift lock keys in their  session.) 
  644.           The only requirement is that KEYLPM.EXE be running since  the
  645.           first  invocation of this program initializes the server  and
  646.           tells it when to clean up behind the shell.  KEYLPM.EXE knows
  647.           when to ask the server to clean up after the shell because it
  648.           receives a notice from the SNOTICE.SYS device driver when the
  649.           session that the shell runs in moves to the foreground.
  650.  
  651.               The  KeyLocks II Server provides three API  entry  points
  652.           for public clients.
  653.  
  654.  
  655.  
  656.                                      - 10 -
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.           USHORT pascal far KeyLockSet(INT num, INT caps, INT scroll);
  666.  
  667.               This  call is made to set the desired state of the  shift
  668.           lock keys.
  669.  
  670.                   num has one of three values:
  671.  
  672.                       1 : Turn on the num-lock key
  673.                       0 : Do not alter the state of the num-lock key
  674.                      -1 : Turn off the num-lock key
  675.  
  676.                   caps has one of three values:
  677.  
  678.                       1 : Turn on the caps-lock key
  679.                       0 : Do not alter the state of the caps-lock key
  680.                      -1 : Turn off the caps-lock key
  681.  
  682.                   scroll has one of three values:
  683.  
  684.                       1 : Turn on the scroll-lock key
  685.                       0 : Do not alter the state of the scroll-lock key
  686.                      -1 : Turn off the scroll-lock key
  687.  
  688.               The return value will be one of the following:
  689.  
  690.                   0               : no problem
  691.                   KL_ERROR_SYSTEM : Either  the  DLL  or  OS/2  is  not
  692.                                     performing as expected.
  693.                   KL_ERROR_BROKEN : The Server has experienced a system
  694.                                     error  that  has  left  it  in   an
  695.                                     unreliable state.   No recovery  is
  696.                                     possible.
  697.                   KL_ERROR_SESSION: The  Server is being called from  a
  698.                                     detached    session.    Since    no
  699.                                     keyboard  state is associated  with
  700.                                     this session, the call is rejected.
  701.                   KL_ERROR_NO_INIT: The    server    has    not    been
  702.                                     initialized.   (KEYLPM.EXE  is  not
  703.                                     running.)
  704.                   KL_ERROR_SEM    : A  system  limit on the  number  of
  705.                                     semaphores in use has been reached.
  706.                   KL_ERROR_HANDLES: A  system  limit on the  number  of
  707.                                     open file handles was reached.
  708.                   KL_ERROR_TIMEOUT: The server's semaphore was tied  up
  709.                                     for longer than 30 seconds.
  710.  
  711.                                     Note: normally, the server hold its
  712.                                     semaphore    for   only    a    few
  713.                                     milliseconds.    This  error  would
  714.                                     likely indicate that the server  is
  715.                                     stuck   (hung)  servicing   another
  716.                                     client.
  717.  
  718.  
  719.           USHORT pascal far KeyLockTidyUp(VOID);
  720.  
  721.  
  722.                                      - 11 -
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.               This   call   forces   the  state   table   returned   by
  733.           WinSetKeyboardStateTable() to agree with the actual state  of
  734.           the keyboard in the PM session.   If you call KeyLockSet() to
  735.           change the state of the shift lock keys,  you do not need  to
  736.           make this call.  
  737.  
  738.               If,   on  the  other  hand,   you  follow  the  procedure
  739.           recommended  in  the  programming  manuals  of  getting   the
  740.           keyboard state table,  altering it,  then restoring it before
  741.           your  application  loses the focus -- three calls in  all  to
  742.           WinSetKeyboardStateTable() -- then you may want to make  this
  743.           call.   A  problem can arise if another application  makes  a
  744.           call to KeyLockSet() during the time that your application is
  745.           holding the keyboard state table.   The keyboard state  could
  746.           then change without your application receiving notice of this
  747.           event.   Therefore you would restore a keyboard  state  table
  748.           that is out of sync with the actual state of the keyboard  in
  749.           the PM session.   To avoid this problem,  call this  function
  750.           either    after    or    in   place   of    the    call    to
  751.           WinSetKeyboardStateTable() to restore.  
  752.  
  753.               Another  method  to  avoid the problem is  to  verify  by
  754.           calling KbdGetStatus() that the keyboard state table that you
  755.           are restoring agrees with the keyboard's actual state.
  756.  
  757.               Yet  a third,  and in many ways better,  method to  alter
  758.           temporarily the shift lock states while your application  has
  759.           the    focus,    would   be   to   avoid   the    calls    to
  760.           WinSetKeyboardStateTable(),  and instead call  KbdGetStatus()
  761.           to  get  the  current shift states,  then  call  KeyLockSet()
  762.           twice,  once  to alter and once to  restore  the  appropriate
  763.           states.
  764.  
  765.               The   possible  return  values  are  the  same   as   for
  766.           KeyLockSet(), with the following exception:  KL_ERROR_SESSION
  767.           will be returned unless your application is a PM  application
  768.           or running in a OS/2 text window.
  769.  
  770.  
  771.           USHORT pascal far KeyLockQStable(VOID);
  772.  
  773.               If  an  error  is received by an  application  calling  a
  774.           KeyLocks  II  Server API entry point,  this function  may  be
  775.           called to determine the resulting state of the server.  
  776.  
  777.               The return value will be one of the following three:
  778.  
  779.                   KL_STABLE       : The shift lock states and the shift
  780.                                     key  lights are still in sync,  and
  781.                                     the  server  can  be  expected   to
  782.                                     restore  the shift lock keys  to  a
  783.                                     state  that is compatible with  the
  784.                                     PM Shell if it is de-initialized.  
  785.  
  786.  
  787.  
  788.                                      - 12 -
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.                   KL_UNSTABLE     : The shift lock states and the shift
  798.                                     key  light  may  be  out  of  sync,
  799.                                     however, the next call to any other
  800.                                     KeyLock   II  Server  API  can   be
  801.                                     expected  to  restore  the   proper
  802.                                     relationship  between the keys  and
  803.                                     the lights if it succeeds.
  804.  
  805.                   KL_BROKEN       : The lights and the keyboard  states
  806.                                     may  be out of sync and the  server
  807.                                     has arrived at a point where it can
  808.                                     no longer recover.
  809.  
  810.               Additional  note:  there  is  no  requirement  that  this
  811.           function  be  called.    It  is  provided  for  informational
  812.           purposes only.
  813.  
  814.               Two  files  are  included for  use  by  programmers  when
  815.           programming  to use the KeyLocks II Server  API.   KEYLOCKS.H
  816.           contains  the function declarations and definitions  for  the
  817.           public  clients of KeyLocks II Server.   KEYLOCK.LIB  is  the
  818.           export  library  to  link with when  calling  either  of  the
  819.           functions documented.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                                      - 13 -
  855.  
  856.  
  857.  
  858.  
  859. 
  860.