İnputbox ta Password Karakteri Kulanma

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Unutulan Değil iz bırakan OL!
Süper Üye
Katılım
19 Mar 2016
Mesajlar
1,329
Tepki puanı
22
Ödüller
10
Yaş
94
10 HİZMET YILI
unutmadan bunu bir kere kullanırsanız programda kullanacağınız butun inputboxlar şifreli olur

PublicClass Form1

PrivateDeclareFunction FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName AsString,ByVal lpWindowNameAsStringAs Int32
PrivateDeclareFunction GetWindow Lib "user32" (ByVal hwnd As Int32, ByVal wCmd As Int32) As Int32
PublicDeclareFunction SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByValwMsg As Int32, ByValwParam As Int32, ByVal lParam As Int32) As Int32

Dim inputTitle AsString = "Enter the Password!"
Dim returnedPW AsString
Const asteriskKeyCode = 42
PublicConst EM_SETPASSWORDCHAR = &HCC
PublicConst WM_CREATE = &H1
Dim windowHandle As Int32
PublicConst GW_CHILD = 5

PublicSub setPassword()
Dim editWindow As Int32
editWindow = GetWindow(windowHandle, GW_CHILD)
SendMessage(editWindow, EM_SETPASSWORDCHAR, asteriskKeyCode, 0)
EndSub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Result.ToInt32 = WM_CREATE Then
windowHandle = FindWindow(vbNullString, inputTitle)
ElseIf windowHandle > 0 Then
setPassword()
windowHandle = 0
EndIf
EndSub

PrivateSub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
lblPw.Text = "InputBox Password:"
returnedPW = InputBox("Enter the Password In the box!", inputTitle, "password!", 0)
IfNot returnedPW = Nothing AndAlso returnedPW = "password!"Then
lblPw.Text = "InputBox Password Is: " & returnedPW
Else
lblPw.Text = "InputBox Password Is: Wrong!"
MessageBox.Show("Wrong Password!"" Try Again")
EndIf
EndSub
EndClass 
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst