How to implement WCF Callbacks using a proxy class library and VB6 client
We have an application which acts as a touchscreen overlay. It provides custom touchscreen keyboards and numeric pads which sit over the top of other applications which require keyboard entry.
It is written as a standalone VB6 ActiveX EXE and provides a COM interface for applications to request keyboards etc be displayed when needed. Button presses are fed back to the applications from the touch server using the SendInput API.
Ive been asked to look at reworking this overlay using WPF but also to look at improving the link between the overlay and the applications that use it. As well as individual key-presses we also want to be able to have buttons representing things like URLs or product codes.
The new overlay will be written in C# using WPF, the applications that will use it are all written in VB6. Im looking for suggestions on how best to implement two-way communications between them.
My first thought was to host a WCF service in the overlay and use 开发者_运维百科callback contracts. Applications would register with the overlay and receive notifications related to the overlay button pushes through the callback contract.
The clients are all VB6 applications though and so will require the use of a proxy dll to wrap up the service interface. I can allow the clients to register/unregister through this interface but Im unsure how to implement the callbacks using a proxy.
Also the client application and overlay may be running for some time, how do I ensure that the communication is persistent and stable?
Id appreciate any input you might have regarding any potential problems/solutions related to this approach. Alternatively if you think WCF is the wrong choice here Id be happy to consider other options?
Are you envisaging creating a COM DLL as a wrapper for the WCF, and then utilising this object in VB6?
If so, then you can let the DLL handle the callbacks, then raise an event on the COM interface as normal that you handle inside the VB6 applications using a WithEvents object.
Using WCF for this sounds like a reasonable approach to me, especially when you are in transition between multiple versions.
精彩评论