我想将一串字符逐个逐个的在文本框中输出,我用一个timer控件,然后在timer事件中控制text1.text=text1.text+"待输出的字符",但是屏幕会有些闪烁。
我知道如果是输出英文字符的话,可以用sendkeys可以模拟敲键盘,那么,如果是中文的话,是不是也有api函数可以实现这个功能呢?谢谢!
我知道如果是输出英文字符的话,可以用sendkeys可以模拟敲键盘,那么,如果是中文的话,是不是也有api函数可以实现这个功能呢?谢谢!
解决方案 »
- VB中Clipboard问题
- vba 程序的启动点问题
- msflexgrid中如何让行高根据内容自动调整?
- 如何判断鼠标不在当前窗口上
- 还是msflexgrid的问题
- *********超级麻烦问题,咱怎么让我的程序自动安装win2000/xp的FAX呀,并添加一个FAX打印机***
- 我是菜鸟,请问这样的地址怎样的调用?
- LISTVIEW 数据导出到EXCEL表格的问题请教(在线等急啊)
- 在多行textbox中,怎样实现定长输入?(如:到了10个字符换下一行输入)
- help!寻找VB开发数据库资料
- 告急~~~~~~~~毕业设计~~~~~~~VB打印报表用 Mcrosoft DataReport
- 积分运算?
试试。
include <windows.h>
#include <ole2.h>char _stdcall MidAsc(BSTR str,int n)
{
LPSTR pA;
pA=(LPSTR)str;
return *(pA+n-1);
}int _stdcall StrLen(BSTR str)
{
return strlen((LPCSTR)str);
}’这是VB程序,API你自己声明,还有动态连接库的声明
Option Explicit Const WM_CHAR = &H102
Private Sub Command1_Click()
Timer1.Enabled = True
End SubPrivate Sub Form_Load()
SetCurrentDirectory (App.Path)
End SubPrivate Sub Timer1_Timer()
Dim hWnd As Long
Dim FormThreadID As Long
Dim CWndThreadID As Long
hWnd = GetForegroundWindow()
If hWnd = Me.hWnd Then Exit Sub
FormThreadID = GetCurrentThreadId()
CWndThreadID = GetWindowThreadProcessId(hWnd, 0)
AttachThreadInput CWndThreadID, FormThreadID, True
hWnd = GetFocus()
AttachThreadInput CWndThreadID, FormThreadID, False
If hWnd <= 0 Then Exit Sub
Dim i As Integer
Dim lAsc As Long
Text4 = ""
For i = 1 To Len(Text1)
lAsc = MidAsc(Text1, i) And &HFF
Text4 = Text4 + str(i) + "-" + str(lAsc) + "-" + str(Asc(Mid(Text1, i, 1))) + vbCrLf
PostMessage hWnd, WM_CHAR, Asc(Mid(Text1, i, 1)), 0
'PostMessage hWnd, WM_CHAR, lAsc, 0
Next i
Timer1.Enabled = False
End Sub