 |
WM_COPYDATA,...
|
|
On Thu, 3 Jul 2008 05:09:59 +0200, Kerem Gümrükcü <...@hotmail.com
Hi,
can someone tell me what the path of
a WM_COPDATA is? You start
At SendMessage/PostMessage and
it goes to the target apps Handler
routine, but what happens with the data
in between the SendMessage and getting
it on the target data. Will the Memory
be stored temporarilly somewhere and read
from there or how will the memory delivered?
TIA,...
Regards
Kerem
--
-----------------------
Beste Gr Best regards / Votre bien devoue
Kerem Gst Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
 |
On Wed, 02 Jul 2008 22:22:21 -0500, "Doug Harrison [MVP]" <...@mvps.org
On Thu, 3 Jul 2008 05:09:59 +0200, Kerem Gümrükcü <...@hotmail.comwrote:
Yes, a copy will be made to memory the target process can read. If you want
to avoid this, use memory mapped files.
--
Doug Harrison
Visual C++ MVP
|
 |
On Thu, 3 Jul 2008 10:26:48 +0200, Kerem Gümrükcü <...@hotmail.com
Hi Doug,
thanks for your answer. One more Question: Where is the copy
holdet, in Clipboard or some other locked memory?
Regards
Kerem
--
-----------------------
Beste Gr Best regards / Votre bien devoue
Kerem Gst Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Doug Harrison [MVP]" <...@4ax.com...
|
 |
On Thu, 3 Jul 2008 10:19:48 -0400, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp
"Kerem Gree...@TK2MSFTNGP02.phx.gbl...
In the application that receives the WM_COPYDATA message, the address of the
copy is passed in lParam of the message. It is in a temporary buffer, so
you must copy the data from the temporary buffer into memory that you
allocate in your WM_COPYDATA message handler.
--
Scott McPhillips [VC++ MVP]
|
 |
On Thu, 03 Jul 2008 09:54:49 -0400, Joseph M. Newcomer <...@flounder.com
Certainly NOT the clipboard. It doesn't really matter. But a copy is made, temporarily
mapped into the recipient's address space, and deleted when you return from handling the
CopyData call.
joe
On Thu, 3 Jul 2008 10:26:48 +0200, Kerem Gümrükcü <...@hotmail.com
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
|
 |
On Thu, 3 Jul 2008 09:50:06 -0700, "Nick Schultz" <...@flir.com
so i have classes A and B with the following definitions:
class A{
unsigned char m_priority;
std::vector<char std::vector<B}
class B{
long m_id;
unsigned int m_flags;
unsigned char m_data[8];
unsigned long m_time;
}
Would I be able to send an instance of class A from process 1 to process 2
using WM_COPYDATA, by simply filling the COPYDATASTRUCT in process 1, copy
the struct to local memory in process 2, and cast COPYDATASTRUCT.lpData as
class A?
Is that how I would do it? or would having a vector complicate things?
Nick
"Joseph M. Newcomer" <...@4ax.com...
|
 |
On Thu, 03 Jul 2008 13:35:34 -0400, Joseph M. Newcomer <...@flounder.com
See below...
On Thu, 3 Jul 2008 09:50:06 -0700, "Nick Schultz" <...@flir.com
Absolutely not. std::vector puts the actual contents somewhere else, so what the
receiving process would get is
[P] [yyyy] [zzzz]
where [P] is m_priority, [yyyy] is a pointer to the vector contents, and [zzzz] is a
pointer to the vector contents. I would do this as I described earlier:
class A {
DWORD m_len; // total length of this structure
BYTE m_priority;
DWORD m_data;
DWORD m_packets;
BYTE info[1];
}
where m_data is the offset into the data array where the assembled data is found
(typically 0) and m_packets is the offset into the data array where the raw packets are
found. THus, what I would send is
[LLLL][P][...][0000][0079][D0D1D2D3...D78][R0..R7][R0..R7]...
where LLLL is the total length of the structure, which is
sizeof(A) + data.size + rawPackets.size * sizeof(B);
Assuming you have std::vector<BYTE
(using char instead of BYTE is often an error; for raw data use BYTE unless the values are
8-bit signed values; you will have fewer errors)
A * ptr = (A*)new BYTE[sizeof(A) + data.size + rawPackets.size * sizeof(B)];
then you would do
memcpy(A-
(I forget the method of std::vector that gives you the address of the elements, you;ll
have to see what is used for 'whatever')
A-A-memcpy(&A-
Now THIS you can send with WM_COPYDATA!
joe
****
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
|
 |
On Thu, 3 Jul 2008 11:44:34 -0700, "Nick Schultz" <...@flir.com
Thanks joe, is this called serialization?
also, while I still understand your example, memcpy is defined as:
void * memcpy ( void * destination, const void * source, size_t num );
Thanks,
Nick
"Joseph M. Newcomer" <...@4ax.com...
|
 |
On Thu, 03 Jul 2008 16:19:37 -0400, Joseph M. Newcomer <...@flounder.com
see below...
On Thu, 3 Jul 2008 11:44:34 -0700, "Nick Schultz" <...@flir.com
"serialization" but for the purposes of interprocess communication it is often called
"marshalling" as well.
***
I never remember details of parameter order, particularly because I don't actually use
memcpy on a daily basis (a few times a year at most, in situations like this one)
joe
****
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
|
|
|
|
Latest discussions from this group
(microsoft.public.vc.mfc)
|
Rotate Screen
[10 Oct 2008]
On Fri, 10 Oct 2008 04:43:30 +1000, Ian Semmel <isemmelNOJUNK@NO KUNKrocketcomp.com.a u
...
I am displaying stuff on a second monitor.
Is there any straight forward way to rotate it...
|
use of sendinput
[09 Oct 2008]
On Thu, 9 Oct 2008 08:36:16 +0200, "J-F Portala" <jfportala@free.f r
Hi,
I aml trying...
to create a small vitual numpad.
On focus on a numerical field EDIT1 from a dialog box, I...
|
Sticky AfxMessageBox
[09 Oct 2008]
On Thu, 09 Oct 2008 10:11:02 +0200, Tage Korsdal Nielsen <tkn@korsdal.dk
Hi All,
From...
the code below I get the following experience:
First time the "else code block" is run...
|
| More... |
|
|
|