10 out of 22 rated this helpful - Rate this topic

WM_COPYDATA message

Applies to: desktop apps only

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

#define WM_COPYDATA                     0x004A

Parameters

wParam

A handle to the window passing the data.

lParam

A 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.

Remarks

The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data.

While this message is being sent, the referenced data must not be changed by another thread of the sending process.

The receiving application should consider the data read-only. The lParam parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by lParam. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.

Examples

For an example, see Using Data Copy.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
SendMessage
COPYDATASTRUCT

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Usage on Vista, Windows7 or later.
WM_COPYDATA is blocked by UIPI, and you have to add a filter to the message using ChangeWindowMessageFilter Function.

Check [url=http://msdn.microsoft.com/en-us/library/ms632675%28v=vs.85%29.aspx]ChangeWindowMessageFilter Function[/url] for more information regarding UIPI and how to unblock WM_COPYDATA or similar messages.
WM_COPYDATA supported on NT 3.1 and later
.
WM_COPYDATA supported on NT 3.1 and later
The current MSDN documentation states this is only supported on Windows XP and later. However, MSDN October 2001 clearly states the following: $0$0 $0 $0Windows NT/2000/XP: Included in Windows NT 3.1 and later.$0 $0Windows 95/98/Me: Included in Windows 95 and later.$0 $0Header: Declared in Winuser.h; include Windows.h.$0 $0$0 $0 $0It appears the current docs are wrong - WM_COPYDATA has been around for a long time.$0 $0
C# Definition
WM_COPYDATA = 0x004A
Value
WM_COPYDATA = &H4A