Easy IPC on Windows Mobile?

后端 未结 5 1360
小鲜肉
小鲜肉 2020-12-19 13:00

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 ser

相关标签:
5条回答
  • 2020-12-19 13:25

    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.

    0 讨论(0)
  • 2020-12-19 13:26

    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.

    0 讨论(0)
  • 2020-12-19 13:36

    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.

    0 讨论(0)
  • 2020-12-19 13:38

    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.

    0 讨论(0)
  • 2020-12-19 13:46

    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?

    0 讨论(0)
提交回复
热议问题