开发者

How to know about results of work with COM component?

I sup开发者_Go百科pose this question is more general than working with COM components. I have a .NET client written in C# and COM component written in pure Win32 API. Client side uses this component to perform some actions. How to know on the client that component did its job?

I think it may be socket/pipe, with component writing to it about results, and client reading from it displaying progress to the user. What is the best way to do this?


With COM, you do not control the data flowing over the socket. You have an RPC-like interface, i.e. your client calls a method on a server, which returns a result. There is no notion of streaming results.

In order to do what you mention, you need to design the interface implemented by the client such as, when starting a job, the server returns an identifier and performs the job asynchronously. Then, the client can regularly poll the server, giving the identifier as parameter and asking the server for the actual progress.

Another way to do it is to implement a connection point on the server, which is essentially a callback mechanism, so that the server can inform the client of its progress. See CodeProject 1 or CodeProject 2 for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜