Re: Communicating processes using WM_COPYDATA
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Apr 02, 2005
- 517 views
On Fri, 01 Apr 2005 13:00:07 -0800, Bernie Ryan <guest at RapidEuphoria.com> wrote: >Pete: > When ever you receive a pointer to some data from > windows I read somewhere that you must immediately > make a copy of the data when you receive the message > because the data will no longer be valid on the next message. I did it immediately. The case was P asking Q for a string:
--(NB: I've deleted the actual code, this is best recollection) Q: elsif msg = CD_FILE then text=string&0 mem=allocate(length(text)) -- ?mem poke(mem,text) return {mem} P: poke4(CDS,{CD_FILE,0,0}) mem=c_func(xSendMessage,{hwnd, WM_COPYDATA, NULL, CDS}) -- ?mem text=peek_string(mem) -- <<== //**CRASHES**//
The peek() crashed no matter what; the memory address was correct (I even tried a hard-coded length). Are you saying that peek in this way may sometimes work? Steadily getting even more confused, if that is possible, Pete PS lest anyone misinterpret, this is not about the RDS implementation of peek and poke, but about what is and what is not a valid memory address under the windows OS, I think.