Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Callback function in Powerbuilder.

Status
Not open for further replies.

woories

Programmer
Mar 2, 2001
1
0
0
JP
I'd like to know how to set up callback function in Powerbuilder. As far as I know, there is a way to use DLL. But I don't know how to pass the data to the Powerbuilder application when I receive the data.

Regards,

Kim Dae-In
 
1) Create your dll with the call.
2) Create a nvo and declare the function aa local or global. For example:

Function boolean GetChildInfoByHwnd(ulong Child, ulong Hwnd, ref str_wobj winfo) Library "Pbenum.dll"

3) Create your function within the nvo:

//************************************************************
// Object: nvo_enum inherited from nonvisualobject
// Function: uf_getchildinfobyhwnd
// Access: public
// Arguments: unsignedlong al_parent
// unsignedlong al
// ref str_wobj astr
// Returns: integer
//************************************************************
str_wobj lstr
Integer li_buf=255
Integer li_rtn
String ls_msg

lstr.WinCaptionBuffer = Space(li_buf)
lstr.WinCaptionSize = li_buf
lstr.WinClassBuffer = Space(li_buf)
lstr.WinClassSize = li_buf
If GetChildInfoByHwnd(al_parent, al, lstr) Then
lstr.WinClassBuffer = Trim(lstr.WinClassBuffer)
lstr.WinCaptionBuffer = Trim(lstr.WinCaptionBuffer)
astr = lstr
li_rtn = 1
End If
Return li_rtn
//************************************************************

4) In this function I defined the following structure to pass to the DLL to fill:

$PBExportHeader$str_wobj.srs
$PBExportComments$Window structure for DLL calls
global type str_wobj from structure
unsignedlong winhandle
integer processid
boolean isvisible
boolean isenabled
boolean isiconic
string wincaptionbuffer
unsignedlong wincaptionsize
string winclassbuffer
unsignedlong winclasssize
str_rect rect
end type


Thats it! In this example I used Delphi to create the DLL function and the actual call to the Windows callback.

Paul Mele
DFAS-CL/TSAD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top