Re: String --> Pointer --> LongInt
- From: erewhon@xxxxxxxxxx (J French)
- Date: Fri, 14 Oct 2005 08:41:12 +0000 (UTC)
On Thu, 13 Oct 2005 21:05:31 +0100, "Hary" <haryhary@xxxxxxxx> wrote:
>the code below worx fine:
>
>
>Global Var A: String;
>
>begin
> PostMessage(self.Handle,Msg1,0,LongInt(Pointer(A)));
>end;
So you are going in for obfuscation and using PostMessage
- as far as I remember I'm the person who suggested that in another
thread
As you've already been warned, this is rather dangerous for sending
strings as they can move around.
Here is what it says in the Win32 Programmer's Reference
<quote>
If you send a message in the range below WM_USER to the asynchronous
message functions (
PostMessage, SendNotifyMessage, and SendMessageCallback), make sure
that the message parameters do not include pointers. Otherwise, the
functions will return before the receiving thread has had a chance to
process the message and the sender will free the memory before it is
used.
</quote>
I must confess I am not sure what WM_USER has to do with it, it is
profoundly unlikely that PostMessage changes its behaviour from
asynchronous to synchornous above WM_USER
One technique I used successfully for inter app communication was to
break the string into four byte chunks and send a stream of messages,
with the string being 'rebuilt' by the recipient.
It sounds rather wasteful, but generates a lot less activity than
simply waving the mouse.
.
- References:
- String --> Pointer --> LongInt
- From: Hary
- Re: String --> Pointer --> LongInt
- From: J French
- Re: String --> Pointer --> LongInt
- From: Hary
- Re: String --> Pointer --> LongInt
- From: Maarten Wiltink
- Re: String --> Pointer --> LongInt
- From: Hary
- Re: String --> Pointer --> LongInt
- From: J French
- Re: String --> Pointer --> LongInt
- From: Hary
- String --> Pointer --> LongInt
- Prev by Date: Re: String --> Pointer --> LongInt
- Next by Date: Re: playing the wave file "byte by byte"
- Previous by thread: Re: String --> Pointer --> LongInt
- Next by thread: Re: String --> Pointer --> LongInt
- Index(es):
Relevant Pages
|