Solved

WM_COPYDATA USING?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 37
Error on moodle after upgrade 3 123
Importing Special Characters in Dynamics GP Through Integration Manager 3 69
Making an alias 7 81
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

21 Experts available now in Live!

Get 1:1 Help Now