// 004_进程通讯_WM_COPYDATA_接收方.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <windows.h>
#include "resource.h"
#include <atlstr.h>
INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM w, LPARAM l)
{
switch (uMsg)
{
case WM_CLOSE:
EndDialog(hWnd,0);
break;
case WM_COPYDATA:
{
COPYDATASTRUCT* pCds = (COPYDATASTRUCT*)l;
CString buff;
buff.Format(L"%x 大小:%d 数据:%s",
pCds->dwData,
pCds->cbData,
pCds->lpData);
MessageBox(hWnd, buff, L"提示", 0);
}
break;
default:
break;
}
return false;
}
int WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd )
{
DialogBox(hInstance,
(TCHAR*)IDD_DIALOG1,
NULL,
DlgProc);
}