|
-
February 7th, 2001, 07:06 PM
#1
API - WM_GETTEXT is failing to work correctly....
Hi-
I am using the postmessage function and the WM_GETTEXT constant to obtain the text from a window but it doesnt want to work with this one window. The coding I have works on other windows but for some reason I can not get the text from this particular window. It is not a password box or anything, its just a window. I checked to make sure it was enabled and it is enabled. Does anyone know how I can get the text from the window or have any ideas why I can't get the text? Thanks.
Code segment I am using:
' Display the title bar text of window Form1 by sending the
' appropriate messages to it.
Dim wintext as string ' receives the copied text from the target window
Dim slength as Long ' length of the window text
Dim retval as Long ' return value of message
' First, determine how much space is necessary for the buffer.
' (1 is added for the terminating null character.)
slength = SendMessage(wnd, WM_GETTEXTLENGTH, byval CLng(0), byval CLng(0)) + 1
' Make enough room in the buffer to receive the text.
wintext = Space(slength)
' Copy the target window's text into the buffer.
retval = SendMessage(wnd, WM_GETTEXT, byval slength, byval wintext)
' Remove the terminating null and extra space from the buffer.
wintext = Left(wintext, retval)
' Display the result.
List1.AddItem wintext
FaRd0wN
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
|