inputbox内的输入字符能否用“*”代替?

lifdb 2004-05-07 11:07:53
inputbox内的输入字符能否用“*”代替?
...全文
29 7 点赞 打赏 收藏 举报
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wlk 2004-05-10
up
  • 打赏
  • 举报
回复
lifdb 2004-05-10
谢谢
  • 打赏
  • 举报
回复
BlueBeer 2004-05-08
同意楼上观点~
  • 打赏
  • 举报
回复
broown 2004-05-08
这样做会使简单的编程,变为复杂的操作。你还不如直接新建一个from直接做个相同功能的inputbox,并在text的属性栏Password=true
  • 打赏
  • 举报
回复
yjplus 2004-05-08
Password=TRUE
  • 打赏
  • 举报
回复
wumy_ld 2004-05-08
1。做个窗体来模拟一个 inputbox 要简单得多。

2。如果非要用inputbox,不是不可以实现,而是比较麻烦(可能会不稳定)代码如下:

’ 可以启动一个线程序专门用于监控INPUTBOX对话框的,如果INPUTBOX找到,就给
’ 它里面的文本框发送一个EM_SETPASSWORDCHAR的消息就可以了。
’ 线程函数里面的应该使用FindWindow来找到该INPUTBOX的窗口。
’====================转帖:

’-----------------以下代码测试通过--------------------
’以下代码放在模块文件中(.bas)
Option Explicit
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Public Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, ByVal lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Public Const EM_SETPASSWORDCHAR = &HCC

Public g_bDone As Boolean
Public g_strTitle As String


Public Sub HookInputBoxThread()
Do Until g_bDone
Dim h As Long, hText As Long
h = FindWindow("#32770", g_strTitle)
If h <> 0 Then
hText = GetDlgItem(h, &H1324)
If hText <> 0 Then
SendMessage hText, EM_SETPASSWORDCHAR, Asc("*"), 0
g_bDone = True
End If
End If
Loop
End Sub



,--------------以下代码为测试代码---------------------------
Option Explicit

Private Sub Command1_Click()
Dim hThread As Long, lpThreadID As Long
g_bDone = False
g_strTitle = "测试程序"
hThread = CreateThread(ByVal 0&, ByVal 0&, AddressOf HookInputBoxThread, ByVal 0&, 0, lpThreadID)


Dim s As String
s = InputBox("请输入数据", g_strTitle)
MsgBox s
End Sub
==========================
  • 打赏
  • 举报
回复
yinweihong 2004-05-07
http://www.5ivb.net/club/dispbbs.asp?boardID=1&ID=25243
  • 打赏
  • 举报
回复
相关推荐
发帖
VB基础类
加入

7545

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2004-05-07 11:07
社区公告
暂无公告