Results 1 to 4 of 4

Thread: Input Boxes

  1. #1

    Thread Starter
    Lively Member brjames's Avatar
    Join Date
    Jan 2000
    Location
    Tenby, Wales, UK
    Posts
    121

    Smile

    I am using an input box to enter a password so the user can enter the password maintenance section of my password system. The trouble is that I want the input box to display the password typed in by the user as * instead of text so that no one else can read the password as it is keyed in.

    Does anyone know how to this?

    Thankx

    Ben

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'set the input of an input box to password characters
    '---bas module code-- 
    Option Explicit 
    
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 
    
    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long 
    
    Public Declare Function SetTimer& Lib "user32" (ByVal hwnd&, ByVal nIDEvent&, ByVal uElapse&, ByVal lpTimerFunc&) 
    
    Public Declare Function KillTimer& Lib "user32" (ByVal hwnd&, ByVal nIDEvent&) 
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 
    Public Const NV_INPUTBOX As Long = &H5000& 
    Public Const EM_SETPASSWORDCHAR = &HCC 
    Public Sub TimerProc(ByVal hwnd&, ByVal uMsg&, ByVal idEvent&, ByVal dwTime&) 
        Dim myHwnd As Long 
    'Change here App.Title (defoult InputBox Caption) into your caption 
        myHwnd = FindWindowEx(FindWindow("#32770", App.Title), 0, "Edit", "") 
         Call SendMessage(myHwnd, EM_SETPASSWORDCHAR, 42, 0) 
        KillTimer hwnd, idEvent 
    End Sub 
    
    '--Using - form code: 
    Private Sub Command1_Click() 
    Dim sPass As String 
    SetTimer hwnd, NV_INPUTBOX, 10, AddressOf TimerProc 
    sPass = InputBox("Set Password") 
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    make it easy on yourself:

    create a form called frmInputBox with controls Label1 and Text1, where text1 has PasswordChar set to * Also have Command1 on the form.

    Code:
    ' in a module
    Public Function InputBox(ByVal Prompt As String,ByVal Caption As String)
    frmInputBox.Label1 = Prompt
    frmInputBox.Caption = Caption
    frmInputBox.Show 1
    InputBox = frmInputBox.Text1.Text
    End Function
    
    ' in frmInputBox
    Private Sub Command1_Click()
    Me.Hide
    End Sub
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  4. #4
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    Fan/Addic

    Rhetorical comment:

    Between a fanatic and an addictive member
    (I guess) we'll find the good of both worlds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width