copy_data
Posted 天还是那么蓝
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了copy_data相关的知识,希望对你有一定的参考价值。
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_CREATE: CreateWindow(L"button", L"发送", WS_CHILD | WS_VISIBLE, 10, 10, 100, 30, hWnd, (HMENU)10001, hInst, NULL); break; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // 分析菜单选择: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; case 10001://注意-------------------------------------------- { //构造一个COPYDATASTRUCT的结构体,可以发送任意数据 COPYDATASTRUCT cds = { 0x123, 10, L"15PB" }; //得到目标窗口的句柄 HWND hDesWnd = ::FindWindow( NULL, L"06 COPY_DATA接收端"); //向目标窗口发送WM_COPYDATA消息 SendMessage(hDesWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); } //注意----------------------------------------------------------- default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: 在此添加任意绘图代码... EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
以上是关于copy_data的主要内容,如果未能解决你的问题,请参考以下文章