kitchin@hpavla.AVO.HP.COM (Bruce Kitchin) (05/25/90)
I've not done this so there is some risk that my idea wont work, but I think I can point you in the right direction. All keyboard input in Windows and PM is sent in the form of WM_CHAR messages to the window that has the keyboard focus. Normally when you put up a child window (or a field in a dialog box) that is used for text entry, the window procedure for the text entry window receives the WM_CHAR messages, accumulates the text in a buffer and displays the text in the window. You could create a child window or subclass a child in a dialog box so that you rather than the standard window procedure receives the WM_CHAR messages. If you're not echoing because some access codeor pass word is being entered, you might echo * or . for each character received so that the user gets some feedback without compromising the password. While Charles Petzold's book Programming Windows discussed keyboard input, it does not have any examples that come close to what you are asking for. In his book Programming the OS/2 Presentation Manager, he covers the keyboard in chapter 8 (Tapping the Keyboard). There is one example, TypeAway.C, which processes keyboard input in a window procedure. Much of that code is unneeded in what you want since it is concerned with displaying the characters. The example Organ.C may give a clearer picture of how to get keyboard input character by character (the only way to avoid echo that I know of) even if what he does when processing the keystroke is unrelated to your need, you can probably figure out what you need. Good luck.
matts@microsoft.UUCP (Matt SAETTLER) (05/29/90)
In article <102@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes:
]I asked this a while ago but apparently it didn't get transmitted upstream.
]
]Is it possible to accept input without echo (e.g. password fields) under:
]
] (1) MS-Windows
] (2) PM
]
]and if so, how?
]
]Thanks for your help.
Windows 3.0 defines the edit control attribute ES_PASSWORD. I believe
that this replace typed characters with '*' in the display.
-----------------------------------------------------------------------
Matt Saettler I speak for myself, or so I'm told.
williams@umaxc.weeg.uiowa.edu (Kent Williams) (05/30/90)
In article <102@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes: >I asked this a while ago but apparently it didn't get transmitted upstream. > >Is it possible to accept input without echo (e.g. password fields) under: > > (1) MS-Windows > (2) PM > >and if so, how? > I know <0 about programming for (1) or (2), but if you don't have a no-echo option on input, you can set the foreground and background colors the same. This is a trick I started using on CP/M 80 machines! -- Kent Williams 'Look, I can understand "teenage mutant ninja williams@umaxc.weeg.uiowa.edu turtles", but I can't understand "mutually williams@herky.cs.uiowa.edu recursive inline functions".' - Paul Chisholm
gpsteffler@tiger.uwaterloo.ca (Glenn Steffler) (05/31/90)
In article <102@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes: >I asked this a while ago but apparently it didn't get transmitted upstream. > >Is it possible to accept input without echo (e.g. password fields) under: > > (1) MS-Windows > (2) PM > >and if so, how? I can give you a hint for Windows: An easy way to get no-echo input is to capture the edit control message that informs you of a new key press. Simply acknowledge the key stroke, but replace it with an 'x' or whatever... I don't have the SDK in front of me, but I believe the EN_ messages notify the program of any edit control changes. Just use a SetWindowText() command to set the text to all 'x's (for the number of char's entered). ---- Co-Op Scum
rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (05/31/90)
>In article <102@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes: >>I asked this a while ago but apparently it didn't get transmitted upstream. >> >>Is it possible to accept input without echo (e.g. password fields) under: >> >> (1) MS-Windows >> (2) PM >> >>and if so, how? >I can give you a hint for Windows: Under MS Windows I needed a password field with NO echo at all and used window subclassing for it and it works fine. Change the callback function for the edit control in the WM_INITDIALOG message and replace it by your own which handles WM_CHAR itself and passes other messages to the previous one (you have to remember the address of the original callback function). The GetWindowLong() and SetWindowLong() calls are used to replace the callback function's address and get the old one. There is also a symbolic constant (don't heve it in mind) for the parameter to these two calls for the callback function. This should be possible for PM too, but I did not yet need it and therefore did not try it but the MS-Windows solution works fine. In the WM_CHAR message you can either replace the character by '*' or 'x' or whatever you want, remember the ortiginal character and pass the '*' etc. to the original callback function or simply catch the WM_CHAR and the edit control will stay empty all the time. Kai Uwe Rommel Munich rommel@lan.informatik.tu-muenchen.dbp.de
patrickd@chinet.chi.il.us (Patrick Deupree) (05/31/90)
In article <102@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes: >I asked this a while ago but apparently it didn't get transmitted upstream. > >Is it possible to accept input without echo (e.g. password fields) under: > Under Windows I know it's possible. One of our programmers set up a system to do it under Actor. Basically what you do is look for a certain message (I forget the exact message) that tells you that something has just been entered into the edit control. You can then intercept the character and take care of putting whatever character you want into the edit control. Doing this will allow you to, for instance, put asterisks in the password field. Good stuff since I hate it when I can't get an indication of how many characters I've entered into a password field. -- "Organized fandom is composed of a bunch of nitpickers with a thing for trivial pursuit." -Harlan Ellison Patrick Deupree -> patrickd@chinet.chi.il.us
smeans@microsoft.UUCP (Scott MEANS) (06/02/90)
The easiest solution to your problem on OS/2 1.2 or greater is to just create an edit control with the style bit ES_UNREADABLE set. This will cause all characters typed into the control to be echoed as *s. -- /\/\ //\/\\ Disclaimer: I don't speak for anyone, \> </ particularly the Dead. S/ \eans