>Masking input for Password field in CA-dBFast 
Author Message
 >Masking input for Password field in CA-dBFast

>Does anyone know how to mask the input of a field (i.e. PASSWORD)
>using CA-Dbfast ? I found a SET READ VIDEO TO command but it seems
>to work on all fields during the READ. I've also looked at the SET GET VIDEO
>TO and the SET SAY VIDEO TO. I can't seem to find a combination of these
>which will work. My screen consists of two fields LOGIN and PASSWD.
>Any help would be appreciated.
>Tim Willoughby  

If you haven't upgraded to CA-dBFast 2.0D/2.0D1 I suggest that you do
so, the patch is free and you can get it at CA's ftp site
mf.cai.com \caproducts\dbfast
This new version is very stable and it comes with several examples
including the following which does what you want to accomplish.

I hope this helps,


// Extra attributes that can be set for CREATE CONTROL EDITBOX
// 1) Determine if the contents have changed
// 2) Turn the caret on/off
// 3) Make the edit box a password entry box
// 4) Make the editbox READONLY
// 5) Undo changes made to editbox

// Windows API function calls
declare pfunc SendMessage returning integer in dll user.exe
declare pfunc HideCaret returning integer in dll user.exe
declare pfunc ShowCaret returning integer in dll user.exe

#define EM_GETMODIFY                    1032
#define EM_UNDO                                 1047
#define EM_SETPASSWORDCHAR      1052
#define EM_SETREADONLY          1055

sSaveVar = ''

// Create the editbox
create control editbox 'Edit01' at 0,0 save to sSaveVar size 1,20

// Get the window handle for the editbox
hWnd = HWND('Edit01')


// Has the contents of the edit box changed?
// Return value is non-zero if the contents have changed
if (SendMessage(toint(hWnd), toint(EM_GETMODIFY), toint(0), tolong(0)))
        wait 'Contents have changed'
        wait 'Contents have not changed'

// Hide the caret.
// Note: The caret appears for a split-second, since the editbox is
// originally created with one, then we turn it off.
wait 'The caret is hidden'

// Show the caret
wait 'The caret is shown'

// Set the password character to 42 (decimal), which is '*' in ASCII.
// Password character can be set to almost any character
// Note: This will not work on a multi-line editbox.
SendMessage(toint(hWnd), toint(EM_SETPASSWORDCHAR), toint(42), tolong(0))
// Characters will not change until the editbox is updated
update control 'Edit01'
wait 'Password character set'

// Show contents of the editbox
? sSaveVar
wait 'Contents of editbox'

// Turn off the password character
SendMessage(toint(hWnd), toint(EM_SETPASSWORDCHAR), toint(0), tolong(0))
// Asterisks will stay in editbox until updated
update control 'Edit01'
wait 'Password character removed'

SendMessage(toint(hWnd), toint(EM_SETREADONLY), toint(1), tolong(0))
wait 'Editbox is READONLY'

SendMessage(toint(hWnd), toint(EM_SETREADONLY), toint(0), tolong(0))
wait 'READONLY cleared'

// Undo changes
SendMessage(toint(hWnd), toint(EM_UNDO), toint(0), tolong(0))
wait 'Changes Un-done'


Sun, 09 Aug 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Masking input for Password field in CA-Dbfast

2. >CA-dBFast 3.0 or CA-dBFast95

3. VW2 Input Field Masking/Filtering

4. Input Field Mask

5. WBPro input field widgets and edit masks?

6. CA-RET (DBFAST 2.0) <-> XBASE++

7. >How 2 use NTX with CA-dBFast?

8. >CA-dBFast error 186?

9. >CA-dBFast Question

10. >Using Borland C++ 4.5 with CA-dBFast 2.0d1

11. >How to Create a Browse Window in CA-dBFast 2.0D1

12. Testing network prgs in CA-Clipper / CA-dBFast


Powered by phpBB® Forum Software