473,383 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

*** 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:

Expand|Select|Wrap|Line Numbers
  1. Public sPwd As String
  2. Public gMsgTitle As String
  3. Public gMsgType As String
  4. Public gMsgText As String
  5. Public gStatusText As String
  6.  
  7. "FindWindowA" (ByVal lpClassName As String, _
  8. ByVal lpWindowName As String) As Long
  9.  
  10. Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias _
  11. "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, _
  12. ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
  13.  
  14. Public Declare PtrSafe Function SetTimer& Lib "user32" _
  15. (ByVal hwnd&, ByVal nIDEvent&, ByVal uElapse&, ByVal _
  16. lpTimerFunc&)
  17.  
  18. Public Declare PtrSafe Function KillTimer& Lib "user32" _
  19. (ByVal hwnd&, ByVal nIDEvent&)
  20.  
  21. Private Declare PtrSafe Function SendMessage Lib "user32" Alias _
  22. "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As LongPtr, _
  23. ByVal wParam As LongPtr, lParam As Any) As LongPtr
  24.  
  25. Const EM_SETPASSWORDCHAR = &HCC
  26. Public Const NV_INPUTBOX As Long = &H5000&
And Function:

Expand|Select|Wrap|Line Numbers
  1. Public Function TimerProc(ByVal lHwnd&, ByVal uMsg&, _
  2. ByVal lIDEvent&, ByVal lDWTime&) As LongPtr
  3.  
  4. Dim lTemp As Long
  5. Dim lEditHwnd As Long
  6. lTemp = FindWindowEx(FindWindow("#32770", "gMsgText"), 0, "Edit", "")
  7. lEditHwnd = FindWindowEx(FindWindow("#32770", "gMsgTitle"), 0, "Edit", "")
  8.  
  9. Call SendMessage(lEditHwnd, EM_SETPASSWORDCHAR, Asc("*"), 0)
  10.  
  11. KillTimer lHwnd, lIDEvent
  12. End Function
Input box:

Expand|Select|Wrap|Line Numbers
  1. Private Sub OpnAdm_Click()
  2.  
  3. gMsgTitle = "Begrenset Omrde"
  4. gMsgType = vbOKOnly + vbInformation
  5. gMsgText = "Tast inn passord"
  6.  
  7.  
  8. lTemp = SetTimer(Me.hwnd, NV_INPUTBOX, 1, AddressOf TimerProc)
  9. sPwd = InputBox(gMsgText, gMsgTitle)
  10.  
  11.  
  12. If strPasswd = "" Or strPasswd = Empty Then
  13. Exit Sub
  14. End If
  15.  
  16. If strPasswd = "yslg53481" Then
  17. DoCmd.OpenForm "frmBatchReg"
  18. Else
  19. MsgBox "Beklager, du har ikke tilgang til denne delen av programmet", vbOKOnly, "Sikkerhetssjekk"
  20. Exit Sub
  21. End If
  22.  
  23.  
  24. 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 easyer 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? :)
Nov 14 '14 #1
4 4461
Seth Schrock
2,965 Expert 2GB
I really don't know what all that code that you have created does, but I think that I have a solution that would be much simpler. Instead of using a prebuilt inputbox, create your own form and set its Modal property to Yes. This would allow you to put in your own textbox and set its Input Mask property to all stars. Just pass a true or false back to the calling form via a public variable to tell the calling form whether or not to allow the person to perform the next action.
Nov 16 '14 #2
Ty for answer, but the challenge here I am trying to overcome is to do it without a textbox ;)
Nov 18 '14 #3
Seth Schrock
2,965 Expert 2GB
An InputBox has a textbox. You don't have to have the textbox bound to a field, so there would be no tracking what was entered after the form is closed.
Nov 18 '14 #4
Ty for answers, but this took to much time. So I converted to 32 bit. Solved the whole problem :)
Nov 21 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Yang | last post by:
Hi Is it possible to mask console input in a c# console application? What I mean is: if I entered string "test" in the console, it'll echo "****"(or nothing) instead of the string "test". I've...
1
by: Nitin | last post by:
I have created a console based application using C# which asks for the user identification to work using that system. Now, the problem is that i'm not able to hide or encrypt the password on the...
1
by: Joe Spin | last post by:
Hi, I'm using the TextBox.PasswordChar property with a '*' to mask passwords written in the textbox. In some workstations it works fine , but there are some workstations (win2K and XP) that...
3
by: Les | last post by:
Hi all, i have an input box that i need the user to put in a password and just wondered if it is possible to just show a * as he types in the letters as per the normal password inputbox ? any...
0
by: xiang | last post by:
I wanted to mask password using inputbox but how come when i enter the code to mask the password in vbscript, its show me error on 'Object required'.
2
jrtox
by: jrtox | last post by:
Hello, Can i ask help from you guys. Ok, I want my records on the datagrid to be shown like " ******** " , not on readable format like "Password", . But not changing the Original data on my...
4
by: Mai Le | last post by:
Hello Expert, I have a code below with inputbox. I would like to have format *** when I type in the box instead of word. So Please help. I did not know. Thanks alot Mai Le Private Sub...
1
by: siyuangao | last post by:
I made a program that require user input here is code: while(Buffer != 13) { TempPass2.push_back(Buffer); cout << '*'; Buffer = _getch();...
3
by: Ryno Bower | last post by:
Hello all, I have a table for users. One of the fields in this tblUsers has a password field with input mask password. All is fine through the whole database! My concern is when I go to excel...
1
by: SeadooRider | last post by:
I have a form that has a toggle button to make visable a subform. In order to open the subform the user must proved a password. However, the part that isn't working correctly is that the password box...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.