Solved

WM_COPYDATA USING?

Posted on 2003-11-10
3
450 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best tools for Backup and restore of Wordpress site 6 57
sameEnds challenge 3 159
fizzArray  challenge 1 83
Work with App store 7 52
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

770 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