Board index » Visual Studio » Reliability of WM_COPYDATA in Processing Data between Applications,...

Reliability of WM_COPYDATA in Processing Data between Applications,...

Visual Studio124
Hi,



my questions are straight: How reliable is WM_COPYDATA if

i want to send "static" data, of cource no pointers or refrences?

Is there a Memory Size limitation in theory and in real life? How

fast is this (sure depending on cpu, memory and allover system

performance)?



I never used that message before when i wanted to transfer data

between applications. I always used some sort of ipc, sockets, pipes

IOCTRL, etc,...since they are the best reliable methods available...



Anybody has experience with this WM_COPYDATA?



Regards



Kerem



--

-----------------------

Beste Grüsse / Best regards / Votre bien devoue

Kerem Gümrükcü

kerem.g@arcor.de



Best Quote: "Ain't nobody a badass with a double dose

of rock salt...", Kill Bill Vol.2



Microsoft Live Space: kerem-g.spaces.live.com/

Latest Open-Source Projects: entwicklung.junetz.de

Sign my guestbook: entwicklung.junetz.de/guestbook/

-----------------------

"This reply is provided as is, without warranty express or implied."


-
 

Re:Reliability of WM_COPYDATA in Processing Data between Applications,...

As far as I can tell, it is 100% reliable. And I believe it is fast.



The problems I have experienced deal with poorly-written programs that will do a

SendMessage(HWND_BROADCAST, WM_COPYDATA, ...), and yes, it really happened to me. So what

I do is put a GUID as the first 128 bits of my WM_COPYDATA data, and if I get a message

with the wrong GUID I know someone else wrote a poor program.



See my essay on the safe use of WM_COPYDATA on my MVP Tips site.

www.flounder.com/wm_copydata.htm">www.flounder.com/wm_copydata.htm



You would have to measure performance, but overall, it is probably faster than sockets or

pipes (what IOCTL does IPC?), because all it does is remap the buffer you send into the

other process's address space, which is why you must use, or copy, everything you need

before you return from the handler, because when you return from the handler, the memory

is unmapped.



You can pass pointers, but they have to be __based(...) pointers, and they can only

"point" to other elements in the WM_COPYDATA area. So using this technique, you could

pass a linked list structure around.





joe

On Wed, 21 Nov 2007 09:55:48 +0100, "Kerem Gümrükcü" <kareem114@hotmail.com>wrote:



Quote
Hi,



my questions are straight: How reliable is WM_COPYDATA if

i want to send "static" data, of cource no pointers or refrences?

Is there a Memory Size limitation in theory and in real life? How

fast is this (sure depending on cpu, memory and allover system

performance)?



I never used that message before when i wanted to transfer data

between applications. I always used some sort of ipc, sockets, pipes

IOCTRL, etc,...since they are the best reliable methods available...



Anybody has experience with this WM_COPYDATA?



Regards



Kerem

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-

Re:Reliability of WM_COPYDATA in Processing Data between Applications,...

Hi Joseph,



thank you for the clear information,...





Regards (from Frankfurt/Germany)



Kerem



-----------------------

Beste Grüsse / Best regards / Votre bien devoue

Kerem Gümrükcü

kerem.g@arcor.de



Best Quote: "Ain't nobody a badass with a double dose

of rock salt...", Kill Bill Vol.2



Microsoft Live Space: kerem-g.spaces.live.com/">kerem-g.spaces.live.com/

Latest Open-Source Projects: entwicklung.junetz.de">entwicklung.junetz.de

Sign my guestbook: entwicklung.junetz.de/guestbook/">entwicklung.junetz.de/guestbook/

-----------------------

"This reply is provided as is, without warranty express or implied."





-

Re:Reliability of WM_COPYDATA in Processing Data between Applications,...

I've never had a problem with this mechanism and it seems to happen almost

instantly (as instant as a computer can be). If you are passing a string

you have to make sure the string is available while the data is being

processed. I typically just pass a pointer to a class member that I know

will be available to the program handling the message. I guess the limit

would be like any other memory limit.



I also find this a lot easier to implement than some of the alternative

methods of doing the same thing.



Tom



"Kerem Gümrükcü" <kareem114@hotmail.com>wrote in message

Quote
Hi,



my questions are straight: How reliable is WM_COPYDATA if

i want to send "static" data, of cource no pointers or refrences?

Is there a Memory Size limitation in theory and in real life? How

fast is this (sure depending on cpu, memory and allover system

performance)?



I never used that message before when i wanted to transfer data

between applications. I always used some sort of ipc, sockets, pipes

IOCTRL, etc,...since they are the best reliable methods available...



Anybody has experience with this WM_COPYDATA?



Regards



Kerem



--

-----------------------

Beste Grüsse / Best regards / Votre bien devoue

Kerem Gümrükcü

kerem.g@arcor.de



Best Quote: "Ain't nobody a badass with a double dose

of rock salt...", Kill Bill Vol.2



Microsoft Live Space: kerem-g.spaces.live.com/">kerem-g.spaces.live.com/

Latest Open-Source Projects: entwicklung.junetz.de">entwicklung.junetz.de

Sign my guestbook: entwicklung.junetz.de/guestbook/">entwicklung.junetz.de/guestbook/

-----------------------

"This reply is provided as is, without warranty express or implied."





-