如何vb中讓inputbox的輸入在螢幕上顯示為\"*\"號?
讓使用者輸入密碼時不會給他人看到了!
2006-06-02 09:20:10 · 3 個解答 · 發問者 ZAX . s c r 3 in 電腦與網際網路 ➔ 程式設計
天啊…真的那麼麻煩唷…
2006-06-03 07:12:52 · update #1
Million :
嗯嗯我知道,
只是想說不知道inputbox是不是也可以…
2006-06-03 11:58:06 · update #2
'很麻煩,須用到API若還要加入註解2k字肯定寫不完,可到VB心得筆記參考http://www.hosp.ncku.edu.tw/~cww/html/hook.html'以下在表單Private Sub Command1_Click() EnHooK St = "知識 ┼" S = InputBox("輸入顯示為*號", St) Print "你輸入了 : "; S UnHookEnd Sub'以下在模組Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal H&, ByVal P&, ByVal M&, ByVal I&) As LongDeclare Sub UnhookWindowsHookEx Lib "user32" (ByVal H&)Declare Function CallNextHookEx Lib "user32" (ByVal H&, ByVal N&, ByVal W&, L&) As LongDeclare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongDeclare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal H&, ByVal M&, ByVal W&, L&) As LongDeclare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal H&, ByVal H1&, ByVal S$, ByVal S1$) As LongPublic hH&, St$Sub EnHooK() If hH = 0 Then hH = SetWindowsHookEx(5, AddressOf HkP, 0, App.ThreadID)End SubSub UnHook() If hH Then UnhookWindowsHookEx hH: hH = 0End SubFunction HkP(ByVal C&, ByVal W&, ByVal L&) As Long If C < 0 Then HkP = CallNextHookEx(hH, C, W, L) ElseIf C = 5 Then Dim S$, N& S = String(255, 0) GetWindowText W, S, 255 S = Replace(S, Chr(0), "") If S = St Then N = FindWindowEx(W, 0, "Edit", vbNullString) If N Then SendMessage N, &HCC, Asc("*"), 0 End If End If HkP = 0End Function
2006-06-02 10:58:54 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
自己做個Form,加上TextBox才對,怎麼會去用InputBox輸入呢?
2006-06-03 00:23:12 · answer #2 · answered by ? 5 · 0⤊ 0⤋
在 物件 TEXT 的屬性 PasswordChar 中打入* 就可以了。
2006-06-02 10:14:23 · answer #3 · answered by HOYA小豬 4 · 0⤊ 0⤋