Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Callback funtion to PowerBuilder

170 views
Skip to first unread message

roadm...@yahoo.com

unread,
Oct 9, 2008, 8:38:59 AM10/9/08
to
Is it possible to callback a function in PB from the .NET
via CCW?
http://pbdj.sys-con.com/node/420516

Bruce Armstrong [TeamSybase]

unread,
Oct 9, 2008, 1:14:01 PM10/9/08
to
No more than any ActiveX control could call into PB, since the CCW approach
makes the .net assembly look like ActiveX. If you want .Net calling into
PB, you might want to look at PBNI instead.

<roadm...@yahoo.com> wrote in message
news:48edfb63.720...@sybase.com...

roadm...@yahoo.com

unread,
Oct 21, 2008, 9:40:23 AM10/21/08
to
I want to try the following way in order to callback into
PB:
My question is...how can i pass the window handle from PB to
.NET?

In your DLL,
1. add a new function registerWindow(HWND windowhandle)
return long // export DLL function if your DLL is not an OLE
Object
in this function, your C# code has to keep the window handle
to a member variable for calling back to PowerBuilder

2. In your DLL event,
add code to call PowerBuilder event,
PostMessage(windowhandle, 1024, 0, 0) // or your data

In PowerBuilder script, event 'open'
1. register your PowerBuilder window to C# DLL
- If your C# is an OLE object
// after ole_dll is created and connected
ole_dll.registerWindow(handle(this))

- If your C# is not an OLE object, you need to declare an
external function first, Function long registerWindow(long
al_window_handle) Library "YourDLL.DLL"
registerWindow(handle(this))

2.add an user event in that window 'pbm_custom01' to catch
the calling back from DLL
MessageBox("Hello", "C# DLL")

0 new messages