Solved

WM_COPYDATA USING?

Posted on 2003-11-10
3
451 Views
Last Modified: 2013-11-20
HW to retrive data when is sent using WM_COPYDATA ?
0
Comment
Question by:bob0001
3 Comments
 
LVL 3

Accepted Solution

by:
freewell earned 30 total points
ID: 9713504

// In the sending APP1
#define WM_GETMESG WM_USER+50

typedef struct
{
     int dataA;
     int dataB;
} DATA, *LPDATA;

DATA Data;
COPYDATASTRUCT CopyDataStruct;

CopyDataStruct.dwData = WM_GETMESG;
CopyDataStruct.cbData = sizeof(DATA);  // size of data
CopyDataStruct.lpData = &Data; // data structure

SendMessage(hwnd_APP2,WM_COPYDATA,(WPARAM)(HWND)m_hWnd,(LPARAM)(LPVOID)&CopyDataStruct);




// In the receiving APP2
#define WM_GETMESG WM_USER+50
typedef struct
{
     int dataA;
     int dataB;
}DATA, *LPDATA;

LPDATA pData;
COPYDATASTRUCT *pCopyDataStruct;
...


// ************ Code fragment ****************
//
case WM_COPYDATA:
     pCopyDataStruct = (COPYDATASTRUCT *) lParam;
     switch(pCopyDataStruct->dwData)
     {
     case WM_GETMESG:
          pData = (LPDATA)pCopyDataStruct->lpData;
          pData->dataA; // You get your data!
     break;
     }
0
 

Author Comment

by:bob0001
ID: 9713558
I am using MFC. can i use thid code

0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9713770
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question