Closed Thread
Results 1 to 2 of 2

*** mask password in inputbox

Hybrid View

  1. #1
    Registered User
    Join Date
    11-14-2014
    Location
    Oslo, Norway
    MS-Off Ver
    2013
    Posts
    3

    *** mask password in inputbox

    Hello!

    I am trying to get this code to work.
    It's for making **** in the field of an inputbox, so the password cant be seen.

    I's originally a code for a 32 bit system, so the real challenge here is converting it to 64 bit.

    The code are:

    Public sPwd As String
    Public gMsgTitle As String
    Public gMsgType As String
    Public gMsgText As String
    Public gStatusText As String
    
    "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
    
    Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias _
    "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, _
    ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
    
    Public Declare PtrSafe Function SetTimer& Lib "user32" _
    (ByVal hwnd&, ByVal nIDEvent&, ByVal uElapse&, ByVal _
    lpTimerFunc&)
    
    Public Declare PtrSafe Function KillTimer& Lib "user32" _
    (ByVal hwnd&, ByVal nIDEvent&)
    
    Private Declare PtrSafe Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As LongPtr, _
    ByVal wParam As LongPtr, lParam As Any) As LongPtr
    
    Const EM_SETPASSWORDCHAR = &HCC
    Public Const NV_INPUTBOX As Long = &H5000&
    And Function:

    Public Function TimerProc(ByVal lHwnd&, ByVal uMsg&, _
    ByVal lIDEvent&, ByVal lDWTime&) As LongPtr
    
    Dim lTemp As Long
    Dim lEditHwnd As Long
    lTemp = FindWindowEx(FindWindow("#32770", "gMsgText"), 0, "Edit", "")
    lEditHwnd = FindWindowEx(FindWindow("#32770", "gMsgTitle"), 0, "Edit", "")
    
    Call SendMessage(lEditHwnd, EM_SETPASSWORDCHAR, Asc("*"), 0)
    
    KillTimer lHwnd, lIDEvent
    End Function
    Input box:

    Private Sub OpnAdm_Click()
    
    gMsgTitle = "Begrenset Omrde"
    gMsgType = vbOKOnly + vbInformation
    gMsgText = "Tast inn passord"
      
    
    lTemp = SetTimer(Me.hwnd, NV_INPUTBOX, 1, AddressOf TimerProc)
    sPwd = InputBox(gMsgText, gMsgTitle)
    
    
    If strPasswd = "" Or strPasswd = Empty Then
    Exit Sub
    End If
    
    If strPasswd = "yslg53481" Then
    DoCmd.OpenForm "frmBatchReg"
    Else
    MsgBox "Beklager, du har ikke tilgang til denne delen av programmet", vbOKOnly, "Sikkerhetssjekk"
    Exit Sub
    End If
    
    
    End Sub
    Missing anything? The error I get is type missmatch on AddressOf TimerProc. But I know its also needs converting to 64 bit. Don't know how tough.

    I know its 1000 times easier to just make an new form and pwd mask the inputmask, but this is not the case here. I rather have more code and less forms, and it get's on my nerves that I cant find it out, so just need see this through, especially when so many other 32 bit users got it to work

    Anyone know what to do here?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,982

    Re: *** mask password in inputbox

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. *** mask password in inputbox
    By Kvracing in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2015, 08:16 PM
  2. Hide/Mask Cell Data Unless Password Entered
    By JimmyG. in forum Excel General
    Replies: 1
    Last Post: 06-28-2014, 04:16 PM
  3. [SOLVED] VBA InputBox Password Validation
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-05-2013, 10:25 PM
  4. Asterix when password entered into InputBox
    By adste89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2012, 10:59 AM
  5. InputBox Password
    By noodle48 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2011, 08:18 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1