Path: utzoo!attcan!uunet!seismo!ukma!uflorida!uakari.primate.wisc.edu!sdd.hp.com!ucsd!rutgers!cscnj!paul From: paul@cscnj.UUCP (Paul Moody) Newsgroups: comp.windows.ms Subject: Re: no-echo input Summary: Here is a code fragment Message-ID: <1129@cscnj.UUCP> Date: 1 Jun 90 14:40:36 GMT References: <102@bohra.cpg.oz> <1584@ns-mx.uiowa.edu> <2559@tuminfo1.lan.informatik.tu-muenchen.dbp.de> Organization: Computer Sciences Corp., Piscataway NJ Lines: 37 >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 Here is a simple code fragment for windows 2.x. As has been stated 3.0 includes ES_PASSWORD for this function. In the NORMAL dialog function for the dialog where the password is requested, add the following entry: case WM_CTLCOLOR: if(HIWORD(lParam) == CTLCOLOR_EDIT) /* an edits color */ { HWND hEdit = GetDlgItem(hDlg, MYPASSWORDEDIT); if(LOWORD(lParam) == hEdit) { wReturnCode = (WORD)GetStockObject(WHITE_BRUSH); SetTextColor(wParam, RGB(255, 255, 255)); return wReturnCode; } } break; Note: you MUST return an hBrush if you process the WM_CTLCOLOR message. This brush is used for the background of the control. Dont call UnrealizeObject for stock objects. -- Paul Moody UUCP: rutgers!cscnj!paul Computer Sciences Corporation # the opinions expressed are entirely imaginary #