Private Declare Function FindWindow Lib "user32" Alias _
   "FindWindowA" (ByVal lpClassName As String, _
   ByVal lpWindowName As String) As Long
    
Private 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&)
    
Private Declare Function KillTimer& Lib "user32" _
  (ByVal hwnd&, ByVal nIDEvent&)
    
Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any) As Long
    
' Constants for API set A
Const EM_SETPASSWORDCHAR = &HCC
Public Const NV_INPUTBOX As Long = &H5000&

Public Function TimerProc(ByVal lHwnd&, ByVal uMsg&, _
                          ByVal lIDEvent&, ByVal lDWTime&) As Long

' This function allows for a mask character on an inputbox
'
' Usage (Replace anything between [] with valid names from your project):
'  From a form or module:
'  1. Declare a Long variable
'  2. Call the timer function:  [variable] = SetTimer([form].Hwnd, NV_INPUTBOX, [elapsed time], AddressOf [function name])
'  2b. Example usage from a form: lTemp = SetTimer(Me.Hwnd, NV_INPUTBOX, 1, AddressOf TimerProc)
'  3. Create your InputBox as usual

    Dim lEditHwnd As Long

    ' Find a handle to the InputBox window, then to the textbox
    ' the user types in (Known as "Edit")
    '
    ' **This part is VERY important, here is how the FindWindowEx call should look:
    ' **Only change the parameters that are enclosed in [ ] in the following example
    '
    ' [variable] = FindWindowEx(FindWindow("#32770", "[caption of your InputBox]"), 0, "Edit", "")
    '
    lEditHwnd = FindWindowEx(FindWindow("#32770", "Security Dialogue"), 0, "Edit", "")

    ' Send the mask character to the target InputBox when the user types
    ' The mask character in this sample is the Asc("*") - the "*" can be changed
    ' to whatever you like.
    Call SendMessage(lEditHwnd, EM_SETPASSWORDCHAR, Asc("*"), 0)

    ' Destroy the timer object when done (The user clicks OK or Cancel from the InputBox)
    KillTimer lHwnd, lIDEvent

End Function