|
-
Feb 23rd, 2003, 04:43 AM
#1
Thread Starter
Fanatic Member
WM_GETTEXT missing 1 charecter
I am trying to get the text of an AIM conversation, It seems to get everything but the end is always </HTML missing the > part. What is wrong with this?
VB Code:
Private Sub Command2_Click()
Dim hWndx As Long, kLENGTH As Long
Dim temp As String, ok As Long
hWndx = 918780 '2360364
kLENGTH = SendMessage(hWndx, WM_GETTEXTLENGTH, ByVal 0&, ByVal 0&) + 1
temp = Space(kLENGTH)
ok = SendMessage(hWndx, WM_GETTEXT, ByVal kLENGTH, ByVal temp)
Text1.Text = temp
MsgBox "Length: " & kLENGTH & " But we got: " & Len(Text1.Text)
'Open "C:\TEMP.html" For Output As #1
'Print #1, temp
'Close #1
End Sub
-
Feb 23rd, 2003, 02:08 PM
#2
Fanatic Member
API functions normally need C-style strings. Usually you have to provide them a buffer, in which you can store the desired content. In C strings are arrays of characters, which are always terminated by a 0-character. (byte with value 0.) Probably you have to take that into account in your buffer, so you have to create the buffer one byte larger:
VB Code:
temp = Space(kLENGTH + 1)
I hope this will help.
-
Feb 23rd, 2003, 02:16 PM
#3
Thread Starter
Fanatic Member
hmm, I know about the C style 0 terminating thing, but I thought I fixed that with this line
kLENGTH = SendMessage(hWndx, WM_GETTEXTLENGTH, ByVal 0&, ByVal 0&) + 1
the +1 at the end is the same as temp = Space(kLENGTH + 1) isnt it? also I can get the text of another textbox just fine, like IE URL bar or w/e but it doesnt work on AIM window.
-
Feb 24th, 2003, 07:51 AM
#4
Fanatic Member
Sorry, I missed the + 1 at the end of that line.
I have no other suggestion for now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|