Windows Mobile上的简易IPC? [英] Easy IPC on Windows Mobile?

查看:78
本文介绍了Windows Mobile上的简易IPC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Mobile上的C ++项目(即.NET)中,我正在寻找一种在两个独立运行的应用程序之间轻松通信的方法.应用程序A将运行服务,而应用程序B将为用户提供某些功能-B必须为此调用某些功能.我宁愿不经历在COM中实现任何事情.

In a C++ project (i.e. no .NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some of A's functions. I would rather not go through implementing anything in COM.

实际上,我宁愿不执行任何形式的序列化或类似操作(即,这将排除使用套接字/管道/文件),而是让B将所有参数和指针传递给A,就像A是其中的一部分一样同样,应用C,D和E应该只在A的一个实例运行的情况下就能做到这一点.

In fact, I would prefer not to do any kind of serialization or similar (i.e. this would exclude using sockets/pipes/files), but rather have B pass all parameters and pointers over to A, just like if A were part of B. Also, apps C, D and E should be able to do the same with only one instance of A running.

我应该补充一点,有时B应该将一个数组(或std :: vector或std :: map)返回给A,而先前的大小未知.

I should add that B sometimes is supposed to return an array (or std::vector or std::map) to A where the size is not previously known.

在Windows Mobile和其他平台上有可能吗?

Is this possible on Windows Mobile and possibly other platforms?

推荐答案

您不能只是跨进程共享数据.我不建议使用COM. Windows CE中不存在管道.最好的方法是内存映射文件(例如在台式机上)或点对点消息队列(类似于台式机).哪种更好取决于您的使用情况.

You can't just share data across processes. I don't recommend COM. Pipes do not exist in Windows CE. Your best route is either a memory mapped file (like on the desktop) or a point to point message queue (nothing like on the desktop). Which is better depends on your usage scenario.

不要不要尝试按建议的方法将跨进程内存与VirtualAlloc一起使用,因为这是一种不安全的黑客行为,并且在CE 6.0或更高版本中不受支持,因此您最终将无法在WinMo 7和更高版本下运行

Do not try to use cross process memory with VirtualAlloc as suggested, as it's an unsafe hack unsafe and is not supported on CE 6.0 or later so you'll end up breaking under WinMo 7 and later.

我不建议使用Windows消息和WM_COPYDATA.速度慢,笨拙且极易出错.

I do not recommend using windows messages and WM_COPYDATA. It's slow, kludgy, and highly prone to errors.

人们,如果您没有使用平台来获取声誉积分,请不要仅仅回答问题.如果您不知道该平台,请让其他人帮助他,而不要像追赶他一样.

People, please don't just answer questions when you've not used the platform just to try to gain reputation points. If you don't know the platform, let someone else help the guy instead of sending him on a wild goose chase.

这篇关于Windows Mobile上的简易IPC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆