An application sends the WM_COPYDATA message to pass data to another application

本文详细介绍了如何使用WM_COPYDATA消息在两个应用程序间传递数据。通过具体的语法和参数说明,展示了如何利用该消息轻松实现简单数据如数组的传递。文章还提供了COPYDATASTRUCT结构体的具体定义,帮助开发者更好地理解并应用这一机制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

对于只是在有VB,VC开发两个应用程序中传递数组如此简单的数据,没必要用什么DLL,内存映射之类的大刀吧

WM_COPYDATA Message

--------------------------------------------------------------------------------

An application sends the WM_COPYDATA message to pass data to another application.

Syntax


To send this message, call the SendMessage function as follows.
lResult = SendMessage(      // returns LRESULT in lResult    (HWND) hWndControl,      // handle to destination control    (UINT) WM_COPYDATA,      // message ID    (WPARAM) wParam,      // = (WPARAM) () wParam;    (LPARAM) lParam      // = (LPARAM) () lParam; ); 
Parameters

wParam
Handle to the window passing the data.
lParam
Pointer to a COPYDATASTRUCT structure that contains the data to be passed.
Return Value

If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE.


The COPYDATASTRUCT structure contains data to be passed to another application by the WM_COPYDATA message.

Syntax

typedef struct tagCOPYDATASTRUCT {
    ULONG_PTR dwData;
    DWORD cbData;
    PVOID lpData;
} COPYDATASTRUCT, *PCOPYDATASTRUCT;
Members

dwData
Specifies data to be passed to the receiving application.
cbData
Specifies the size, in bytes, of the data pointed to by the lpData member.
lpData
Pointer to data to be passed to the receiving application. This member can be NULL.

 

转来的,还没经过测试呢,如果有问题概不负责!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值