Easy IPC on Windows Mobile?

北慕城南 提交于 2019-11-29 10:59:31

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.

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.

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.

Since you only need the application (B) to communicate with the service (A), why don't you just use CreateFile and DeviceIoControl with a defined set of IOCTLs?

Here is the good source to start with - http://msdn.microsoft.com/en-us/library/aa446520.aspx You decide which option is the best fit for your needs.

You've covered pretty much all of the bases available; COM, pipes, sockets, memory mapped files. All processes in Windows have completely separate memory spaces, so you can't share anything without using one of those IPC mechanisms.

On Windows Mobile I seem to remember that all processes are mapped into the same address space. So, create message windows in both processes with known names and or class names and use FindWindow in each process to find the other.

Then, SendMessage with a WM_APP defined message id and a pointer to the data to transmit in wParam or lParam.

If I am wrong and Mobile does partition process memory, then just use WM_COPYDATA which - on the desktop uses memory mapping and so is really fast - to send data between the apps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!