Great thanks. I had a few problems at first, still got an AV (actually an
EInvalidePointer Error), but I sorted that.
Thanks heaps, Jeremy Coulter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Ben Taylor
Sent: Monday, 7 May 2001 16:54
To: Multiple recipients of list delphi
Subject: re: [DUG]: Passing pointers with SendMessage
hi!
something like this works: (quick hack, just main bits of code)
----
const
WM_MYHANDLER=WM_USER+1;
type
PmyRecord = ^TmyRecord;
TmyRecord = record
myString:string;
myInteger:integer;
end;
TForm1 = class(TForm)
private
procedure myHandler(var Message: TMessage); message WM_MYHANDLER;
end;
----
procedure TForm1.myHandler(var Message: TMessage);
var
aRecord:PmyRecord;
begin
aRecord:=pmyrecord(Message.wParam);
myListbox.Items.Add(aRecord^.myString);
dispose(aRecord)
end;
procedure TForm1.Button1Click(Sender: TObject);
var
aRecord:PmyRecord;
begin
new(arecord);
arecord.myString:='boo';
PostMessage(form1.Handle,WM_MYHANDLER,integer(aRecord),0);
end;
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"