Date: 02-16-2022
Return to Index
created by gbSnippets
'Toggles display of password characters in TextBox
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
#Include "Win32API.inc"
%IDC_TextBox = 500 : %IDC_Button = 501
Global hDlg As Dword, Psw As Long, Char As String
Function PBMain() As Long
Char = "*"
Dialog New Pixels, 0, "Password Test",300,300,150,100, %WS_SysMenu To hDlg
Control Add Button, hDlg, %IDC_Button, "Hide", 20,10,40,25
Control Add TextBox, hDlg, %IDC_TextBox, "Text", 20,50,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = %IDC_Button And Cb.CtlMsg = %BN_Clicked Then
Psw = Psw Xor 1
Control Set Text hDlg, %IDC_Button, IIf$(Psw,"Clear","Hide")
SendMessage GetDlgItem(hDlg,%IDC_TextBox), %EM_SetPassWordChar, IIf(Psw, Asc(Char), 0), 0
Control ReDraw hDlg, %IDC_TextBox
End If
End Function
'gbs_01236
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm