Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does a COM server know which client Fn to call back into
Message
From
21/12/2000 23:12:42
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
How does a COM server know which client Fn to call back into
Miscellaneous
Thread ID:
00456181
Message ID:
00456181
Views:
66
We have this situation:

A piece of Hardware is being controlled by a COM server written in C.

In VFP I use:

oServer = CREATEOBJECT("Servermain.weightsvr")

Servermain is a COM exe and will run in its own workspace.

Now to get the COM server to query the hardware and return a weight to my VFP client, I issue:

nWeight = oServer.GetWeight()

The COM server will accept this call and return a "True" or "False" that the Message has been received. My client will continue to do other things. When a weight is received by the COM server after it has requested this from the hardware, it needs to interrupt the VFP client and pass it the weight.

The client will then use this weight to maybe enable/ disable objects, update the screen etc.

My problem is :

How does the COM server know which function to callback to "interrupt" client processing to pass this weight.

The programmer of the COM says that in ALL languages, including VB, this is possible because the CreateObject "exposes" the client's methods and proceeded to show me in VB.

He said something about using "CreateObject With events" and also said that he can create "Custom Events" in VB.

How I would normally do this type of call would be:

nWeight = oServer.GetWeight("This.Weightcallback")

Where "WeightCallback" is a custom method of my client form that can receive the weight and update controls on the form. So when the COM server calls back, it will interrupt my processes and the code in "WeightCallback" will be run.

This has worked well with OLE servers I have created in VFP.

What I need to know is if not called as above, HOW WILL THE COM SERVER KNOW WHICH METHOD TO CALL INTO THE CLIENT TO INTERRUPT IT, WHEN IT DOES RECEIVE A WEIGHT.

The call to the COM server assumes that the return value will be a T/F as a weight may not be returned immediately.

So how does it know where to interrupt and pass the weight in??

Is this possible in VB but not in VFP?

Can someone shed some light on this or point me to the correct site please?

I have read an excellent article written by Rick Strahal of West Wind but it was about "Using a VFP Server with a C++ client"

I need to know about Using a C++ COM server with a VFP client where the server needs to interrupt the client and pass it some values.

Thanks for this

Bernard
Next
Reply
Map
View

Click here to load this message in the networking platform