Solved

WM_COPYDATA USING?

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now