PDA

Click to See Complete Forum and Search --> : Callback not behaving as expected


RobH
Aug 2nd, 2001, 08:45 AM
Hi. I want my ActiveX server to notify the client (another ActiveX EXE) of events using a callback interface.

I defined a simple dll with a single method called NotifyMe(). I compiled the dll as INotify.dll

Both my projects reference this dll.

In my client I use Implements INotify.NotifyMe

Private Function INotify_NotifyMe() As Variant
MsgBox "it works"
End Function


My server has a registration Method:

Private mNotify as INotify.NotifyMe

Public Function RegisterNotification(ByRef iNotify as NotifyMe)
Set mNotify = iNotify
End Function

So far so good. Everything compiles, no errors. The problem is when the server calls the event nothing happens.

I have a timer that calls mNotify.NotifyMe

What I expect to happen is the implementation on the client to run and the Msgox to appear. But nothing happens. What am I missing? How do I invoke the callback back on the client?

Thanks,
Rob

wolfofthenorth
Aug 2nd, 2001, 12:01 PM
One thing you might try.

You can expose a public method on your server component. Set a reference to that server component in your client component. And call into that method and raise your message there.

MyServer.exe

private objMyClient as MyClient


Class Initalize
set objMyClient = new MyClient
set objMyClient.CallBackObject = me
objMyClient.MyMethod

Public sub CallBack

msgbox, etc....

end sub








MyClient.dll

private objMyCallBack as MyServer


Public property set (lpCallBack as object)

set objMyCallBack = lpCallBack

end property



public Sub MyMethod()

objMyCallBack.CallBack

end Sub


Something like this might be able to work for ya. Hope it helps



:)