Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Feb : 2 or more postmessage() and strings
| Subject: | 2 or more postmessage() and strings |
| Posted by: | "bilm" (fence617..@mypacks.net) |
| Date: | Mon, 11 Feb 2008 19:21:35 |
I have a loop in a thread where many different strings
are posted to a message handler via postmessage().
Currently I'm using GlobalAddAtom/GlobalDeleteAtom
which works but I know it not a good idea so I'm changing it.
If I use ...
var
s: PString;
begin
while looping
New(s);
s^ := 'string 1';
PostMessage(Wnd, am_Message, 0, Integer(s) );
>>> can I use "s" again in the loop (like I can with GlobalAddAtom) ?
New(s);
s^ := 'string 2';
PostMessage(Wnd, am_Message, 0, Integer(s) );
end; // end loop
the message handler would use
var S : PString;
case Message.WParam of
MSGFILTER1 :
begin
S:= PString(Message.LParam);
// display S^;
Dispose(S);
end;
MSGFILTER2 :
begin
S:= PString(Message.LParam);
// display S^;
Dispose(S);
end;
end;
bilm