NCALC - Demonstrate Keyboard and Control handling

NCALC is a simple modification to the calc that comes as a demo with 
Visual Basic. The only enhancements I have made is to allow keyboard entry
and to have the keys depress on each keystroke as if pressed with a mouse.

The technique for keyboard handling involves routing each control to a 
common keyboard handler by setting the KeyDown and KeyUp events 
for each control to pass through ProcessKeyDown and ProcessKeyUp.

In the common KeyDown handler (ProcessKeyDown) there is a SetFocus command
that is followed by a library call to getFocus(). 
Getfocus returns the handle to the control that currently has the focus. 
The handle is then passed to the sendMessage() library call to set 
the state of the button to down. This is reversed in the common KeyUp 
handler (ProcessKeyUp).

Note that in ProcessKeyUp the focus is set to the equals key. This is to allow
enter to work the same as equals. Apparently you cannot intercept the 
enter key with a keydown event, instead it acts on the control with the focus
as if you had clicked on it. If anyone has a 'simple' way to deal with this,
Let me know. (I have a complex way already!).

Look in the global module for definitions of the library routines.

This program was written in as straight forward a manner as possible. Many
improvements and additions are possible. Have fun!

This program is copyright by Microsoft and being distributed in accordance
with the release granted in the (common) (declarations),
any extensions made by myself, Marcus Smaby, are released to the 
public domain. 3/25/92

As an experienced windows and unix programmer, I am available on a work-for-hire basis
for any project that can be performed over CIS, modem and Fax. I have experience
and have taught; SmallTalk V/Win, Turbo Pascal for Windows, C++ for Windows,
Superbase 4, Progress (Unix) and Visual Basic. If you would like to
talk to  me regarding custom programming contact me at my CIS ID.


Marcus Smaby
(72571,3126)



