我想實現從VB程式向發java窗口發送中文字串
不知如何實現?請不吝賜教
用sendkeys只能實現發送英文的

解决方案 »

  1.   

    //用sendkeys只能實現發送英文的为什么?
      

  2.   

    可以查找到对应窗口的句柄
    直接通过API函数发送
    SendMessage lngHwndTemp, WM_SETTEXT, 0&, strCode
      

  3.   

    SetWindowTextW for Unicode
    SetWindowTextA for English
      

  4.   

    Dim lPtr As Long    If IsWindowUnicode(m_hWnd) Then
            If Len(sText) = 0 Then
                SetWindowTextW m_hWnd, StrPtr(vbNullString)
                Exit Sub
            End If
            lPtr = StrPtr(sText)
            SetWindowTextW m_hWnd, lPtr
        Else
            If Len(sText) = 0 Then
                SetWindowTextA m_hWnd, vbNullString
                Exit Sub
            End If
            SetWindowTextA m_hWnd, sText
        End If
      

  5.   

    Sorry,前幾天硬盤掛了,現在才好
    rainstormmaster:能告訴怎樣用sendkeys發送中文嗎?
    我用sendkey發送中文到java窗口會出現亂碼現象
    VBAdvisor(Sunlight):
      

  6.   

    VBAdvisor(Sunlight):
    能給我一個比較完整的例子嗎?
    我API不太會用
    IsWindowUnicode/StrPtr 我找不到
      

  7.   

    //rainstormmaster:能告訴怎樣用sendkeys發送中文嗎?和发送英文没什么区别我估计可能是编码问题,给个你用的java程序的下载地址
      

  8.   

    Private Declare Function IsWindowUnicode Lib "user32.dll" (ByVal hWnd As Long) As Long
    Private Declare Function SetWindowTextW Lib "user32.dll" (ByVal hWnd As Long, ByVal lpString As Long) As Long
    Private Declare Function SetWindowTextA Lib "user32.dll" (ByVal hWnd As Long, ByVal lpString As String) As LongStrPtr不需要特别申明,VB6支持。
      

  9.   

    我是把資料往oracle 的程式中輸入,
    可以手工用剪貼板粘貼中文輸入.
    我有在網上有找一些例子,試過sendmessage 和剪貼板,但都沒有實現我要的結果
      

  10.   

    VBAdvisor(Sunlight):
    sText 要什麼類型啊? 
    我用string好象沒效果
      

  11.   

    sText就是你要发送的字符串。
    sText="Who I am?”
      

  12.   

    我用GetForegroundWindow的hwnd,但結果是將stext的內容發到窗口的標題
    用GetFocus的hwnd沒反應