Listing 1

// Get the handle using the classname
l_parenthandle = inv_extcalls.of_findwindow(ls_class, 
ls_name)

// Get the handle using part of the name
IF l_parenthandle = 0 AND lb_32bit THEN
l_parenthandle = inv_extcalls.of_findwindow('- PowerBuilder')
END IF

IF inv_extcalls.of_gettext(l_parenthandle, ls_caption, 
150) > 0 THEN
// OK
ELSE
return
END IF




Listing 2

int li_charcount = 255
ulong hMainWindow, lu_desktop
string ls_windowtitle

lu_desktop = GetDesktopWindow()

// Get a handle to the first child of the desktop (1st 
main window)
hMainWindow = GetWindow(lu_desktop, 5)
IF IsNull(hMainWindow) THEN RETURN 0

// Loop through Top Level windows until we find the window we want 
DO UNTIL Upper(left(ls_windowtitle, len(as_name))) = Upper(as_name) &
OR Upper(right(ls_windowtitle, len(as_name))) = 
Upper(as_name) &
OR hmainwindow = 0
// Get a handle to the sibling window
hmainwindow = GetWindow(hmainwindow, 2)
IF hmainwindow > 0 THEN
ls_windowtitle = Space(li_charcount)
IF GetWindowTextA(hmainwindow, ls_windowtitle, li_charcount) 
< 0 THEN RETURN 0
END IF

LOOP

IF hmainwindow > 0 THEN
RETURN hmainwindow
ELSE
return -1
END IF





Listing 3

String ls_classn
l_handle = inv_extcalls.of_getwindow(l_handle, 5) //Child
ls_classn = Space(150)
// This is the right sheet (pbworkXX)
inv_extcalls.of_getclassname(l_handle, ls_classn, 150)


//MessageBox(ls_oops, "d, Current class: " + ls_classn)
IF Lower(Left(ls_classn, 6)) <> "pbwork" THEN
MessageBox("Error", "No WORKSHEET (pbworkXX) found " + 
ls_classn)
return
END IF




Listing 4

int code, &
pos = 0, &
len, &
i, &
start = 60
char lc_char
pointer oldpointer

oldpointer = SetPointer(HourGlass!)
len = len(a_string)
Send(a_hndl, WM_KEYDOWN, code, 0)
DO WHILE pos <= len
pos ++
lc_char = Mid(a_string, pos)
code = Asc(lc_char)
IF code = 13 THEN
Send(a_hndl, WM_KEYDOWN, code, 0)
Send(a_hndl, WM_CHAR, code, 0)
Send(a_hndl, WM_KEYUP, code, 0)
continue
END IF
Send(a_hndl, WM_CHAR, code, 0)
LOOP
Send(a_hndl, WM_KEYUP, code, 0)

SetPointer(oldpointer)

Additional Code for this Article zip file ~48.0 KB