Re: Communicating processes using WM_COPYDATA

new topic     » goto parent     » topic index » view thread      » older message » newer message

Pete Lomax wrote:
> 
> 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:
> }}}
<eucode>
> --(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**//
> 
> </eucode>
{{{

> 
> 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.
> 
> 

Pete:

   Your setting DWORD cbData as ZERO

typedef struct tagCOPYDATASTRUCT {  // cds 
    DWORD dwData; 
    DWORD cbData; 
    PVOID lpData; 
} COPYDATASTRUCT; 
 
Members
dwData 
Specifies up to 32 bits of data to be passed to the receiving application. 
cbData 
Specifies the size, in bytes, of the data pointed to by the lpData member. 
lpData 
Pointer to data to be passed to the receiving application

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.ew

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu