进程间发送数据的问题
来源:互联网 发布:电子商务php 编辑:程序博客网 时间:2024/05/17 09:40
向其他进程的窗口发送数据,如果只是发送基本类型的数据,用不着使用WM_COPYDATA消息,因为Jeffrey Richter said in programming application for Microsoft windows: " Fortunately, most messages don't require this type of processing—it takes place only when an application sends interprocess messages. Special processing such as this has to be performed for any message whose wParam or lParam parameters represent a pointer to a data structure. " 我个人是这样理解的,WM_COPYDATA是个进程间消息通信,"It's a shame it's not used more frequently"(said by Jeffrey Richter),在wparam lparam是个结构的地址时如字符串等,WM_COPYDATA是使用的绝佳场合。若进程的消息通信,wparam,lparam只是些基本的数据类型的数据,是用不着WM_COPYDATA,因为他们不是地址,是与进程自身无关的数据,可以直接Send 或Post自己定义的消息。例如: CWnd * pWnd; pWnd=CWnd::FindWindow(NULL,_T("Shell")); if(pWnd!=NULL) pWnd->PostMessage(WM_USER+120,(WPARAM)(int)nData,0);
使用WM_COPYDATA的注意事项:
1.Always send this message; never post it. You can't post a WM_COPYDATA message because the system must free the memory-mapped file after the receiving window procedure has processed the message. If you post the message, the system doesn't know when the WM_COPYDATA message is processed, and therefore it can't free the copied block of memory.
2.It takes some time for the system to make a copy of the data in the other process's address space. This means that you shouldn't have another thread that modifies the contents of the memory block running in the sending application until the call to SendMessage returns.
3.The WM_COPYDATA message allows a 16-bit application to communicate with a 32-bit application and vice versa. It also allows a 32-bit application to talk to a 64-bit application and vice versa. This is an incredibly easy way to have newer applications talk to older applications. Also note that WM_COPYDATA is fully supported on Windows 2000 and Windows 98.
- 进程间发送数据的问题
- sigqueue函数 进程间通信 信号的发送携带数据
- sigqueue函数 进程间通信 信号的发送携带数据
- 用WM_COPYDATA在进程间发送数据
- VC/MFC 不同进程间的消息通信与数据(字符串)发送
- VC/MFC 不同进程间的消息通信与数据(字符串)发送
- VC/MFC 不同进程间的消息通信与数据(字符串)发送
- VC/MFC 不同进程间的消息通信与数据(字符串)发送
- MFC 不同进程间的消息通信与数据(字符串)发送
- socket 发送数据需要注意的问题
- 关于串口发送数据的问题
- Socket连接发送数据的一点问题
- IOS网络编程发送数据的问题
- IOS网络编程发送数据的问题
- UDP通信发送数据的问题
- QserialPort 串口数据发送的问题
- WM_COPYDATA消息机制 不同进程间发送结构体数据
- MFC用WM_COPYDATA在进程间发送数据
- c#,winform,UserContrl,用户控件开发,窗体
- WinForm中实现控件中的值是否为空的判断
- 北川县城为何实行特别管制
- 四川的地震救援行动感动世界
- Linux USB驱动框架分析
- 进程间发送数据的问题
- SQL SERVER 与ACCESS、EXCEL的数据转换
- 电脑新装上myeclipse6,出现问题,打不开?
- python的web framework
- *p++与(*p)++与*(p++)
- MySQL连接样例!
- NSGA2代码分析——dominance.c
- 项目经理如何管理?
- Asp.net 中删除上传的图片