Function GetHWndText(hWnd As Long) As String
hLength = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0)
If hLength < 1 Then
GetHWndText = ""
Else
ReDim bArr1(hLength + 1) As Byte, bArr2(hLength - 1) As Byte
RtlMoveMemory bArr1(0), hLength, 2
SendMessage hWnd, WM_GETTEXT, hLength + 1, bArr1(0)
RtlMoveMemory bArr2(0), bArr1(0), hLength
GetHWndText = StrConv(bArr2, vbUnicode)
End If
End Function
hLength = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0)
If hLength < 1 Then
GetHWndText = ""
Else
ReDim bArr1(hLength + 1) As Byte, bArr2(hLength - 1) As Byte
RtlMoveMemory bArr1(0), hLength, 2
SendMessage hWnd, WM_GETTEXT, hLength + 1, bArr1(0)
RtlMoveMemory bArr2(0), bArr1(0), hLength
GetHWndText = StrConv(bArr2, vbUnicode)
End If
End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货