不用sendkeys,能否用其它函数输出汉字?   注意是汉字输出哦。
谢谢!

解决方案 »

  1.   


    Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long'将一个字符串通过PostMessage传送出去
    'strP:要发送的字符串,字符串可以是含有汉字字符串
    'lngHandle:接收字符串的控件的句柄
    Public Sub subPostString(ByVal strP As String,byval lngHandle as long )
        Dim intP As Integer
        Dim intK As Integer
        Dim lngAsc As Long
        Dim lngP As Long
        Dim strT As String
    On Error GoTo errSub
    '    Debug.Print strP
        For intP = 0 To Len(strP) - 1
            strT = Mid(strP, intP + 1, 1)
            If Asc(strT) <= 0 Then
                lngAsc = AscW(StrConv(strT, 128))
                If lngAsc < 0 Then
                    lngAsc = lngAsc + 65536 '2^16
                End If
            Else
                lngAsc = Asc(strT)
            End If
            lngP = PostMessage(lngHandle, WM_CHAR, lngAsc, 0)
        Next intP
        Exit Sub
    errSub:End Sub
      

  2.   

    lngP = PostMessage(lngHandle, WM_CHAR, lngAsc, 0)问一下,lngHandle怎么得到???
      

  3.   

    Private Sub Form_Load()
    Form1.Show
    CurrentX = 3000
    CurrentY = 1200
    Form1.Print "汉字输出到窗体"
    Picture1.AutoRedraw = True
    Picture1.Print "汉字输出到图片框"
    Debug.Print "汉字输出到即时窗口"
    End Sub