两个进程间通讯的问题
请赐教,
我编写了两个程序,a.exe 和 b.exe
a.exe 是一个对话框程序,前台运行; b.exe 是一个控制台程序,后台运行。
a.exe 如何向b.exe 发送命令消息,控制 b.exe 的运行, 比如,暂停,继续,退出等
最好能有一个较为简单的方法来进行通讯。
请大家赐教!
[解决办法]
比较简单的一种方法是event,弄几个有名的event,b.exe开个线程,WaitForMultipleObjects,妥妥的。socket大材小用了
[解决办法]
About Interprocess Communications
As computer users become more sophisticated, they demand more power from the applications they use. To meet this demand, developers add more features to the applications, and the applications become larger. Large applications eventually become unmanageable, both from a development standpoint and from a user-interface standpoint.
One method you can use to manage larger applications is to produce a specialized application that provides a limited number of features, then enable it to communicate and share data with other specialized applications using some form of IPC. It is not necessary for a single application meet all its users' expectations; applications can communicate and cooperate.
The following IPC mechanisms are supported by the Win32 API:
Clipboard
COM
Dynamic Data Exchange (DDE)
File Mapping
Mailslots
Pipes
RPC
Windows Sockets
WM_COPYDATA
[解决办法]
WM_COPYDATA 窗口消息.