Skip to main content

AccessTr.neT


İnputbox ta Password Karakteri Kulanma

İnputbox ta Password Karakteri Kulanma

#1
unutmadan bunu bir kere kullanırsanız programda kullanacağınız butun inputboxlar şifreli olur

Visual Basic Code
Public Class Form1

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Int32, ByVal wCmd As Int32) As Int32
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32

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

Public Sub setPassword()
Dim editWindow As Int32
editWindow = GetWindow(windowHandle, GW_CHILD)
SendMessage(editWindow, EM_SETPASSWORDCHAR, asteriskKeyCode, 0)
End Sub
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
End If
End Sub

Private Sub 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)
If Not 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")
End If
End Sub
End Class

PROGRAMMER MEHMET
Cevapla
#2
Teşekkürler Sn gitarc..
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da