?
Solved

WM_COPYDATA USING?

Posted on 2003-11-10
3
Medium Priority
?
456 Views
Last Modified: 2013-11-20
HW to retrive data when is sent using WM_COPYDATA ?
0
Comment
Question by:bob0001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
freewell earned 90 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

777 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