Dim s As String
FT_hWnd = FindWindow(vbNullString, "Snow_Win32API 中文帮助(未注册)")
    If FT_hWnd = 0 Then
        MsgBox "False", vbInformation, "Title"
        End
    End If
    
    ID_Control_hWnd = GetDlgItem(FT_hWnd, &H15)
    SendMessage ID_Control_hWnd, WM_SETTEXT, LenB(StrConv(s, vbFromUnicode)), s最后显示出来的却是乱码.该怎么解决?

解决方案 »

  1.   

    你是要获取信息还是设置信息??
    如果是获取请用
    WM_GETTEXT = $000D
      

  2.   


    Dim s As String
    s=string(256,chr(0))
    FT_hWnd = FindWindow(vbNullString, "Snow_Win32API 中文帮助(未注册)")
        If FT_hWnd = 0 Then
            MsgBox "False", vbInformation, "Title"
            End
        End If
        
        ID_Control_hWnd = GetDlgItem(FT_hWnd, &H15)
        SendMessage ID_Control_hWnd, WM_SETTEXT, 256, s
      

  3.   

    晕看错了看成获取文字了    Dim Longitud As Long    ' Longitud del texto del boton
        Dim Texto As String     ' Texto del boton
        Dim slength As Long     ' Longitud del contenido del texto del boton
        Dim retval As Long
        
        Longitud = SendMessage(Boton.hwnd, WM_GETTEXTLENGTH, ByVal CLng(0), ByVal CLng(0)) + 1
        '   Obtenemos la longitud del texto. Recordar que termina en un caracter nulo.
        Texto = Space(Longitud)
        '   Preparamos Texto para recibir todos los caracters del texto
        retval = SendMessage(Boton.hwnd, WM_GETTEXT, ByVal Longitud, ByVal Texto)
        '   Pasamos el primer caracter del texto al final
        Texto = Mid(Texto, 2, Longitud - 2) & Left(Texto, 1)
        retval = SendMessage(Boton.hwnd, WM_SETTEXT, ByVal Longitud, ByVal Texto)