JamesDSM50328
Technical User
Trying to get the text from a PowerBuilder datawindow. I have identified the window which the data resides but am running into difficulties getting the text of the data out.
tried the Sendmessage WM_GETTEXT
tried the GetWindowText
they all end up returning 0
tried the Sendmessage WM_GETTEXT
Code:
dim lresultDW as long 'handle for the datawindow
Dim sOutput as string
Dim lngLen&
Dim szBuffer$
lresultdw = FindWindowEx(hwndParent, &O0, "pbdw120", vbNullString)
lnglen = SendMessage(lresultdw, MsgDef.WM_GETTEXTLENGTH, 0&, 0&
szBuffer=space$(lnglen)+1
sOutput=szbuffer
tried the GetWindowText
Code:
Function GetTextofWindow(hwnd As Long) As String
Dim textlen As Long
Dim titlebar As String
Dim slength As Long
textlen = GetWindowTextLength(hwnd)
titlebar = Space(textlen + 1)
slength = GetWindowText(hwnd, titlebar, textlen + 1)
titlebar = Left(titlebar, slength)
GetTextofWindow = titlebar
End Function
they all end up returning 0