CB_AddString takes a null terminated string, ie. PChar, as an LParam
parameter, ie. Integer. You could just cast the string to a pchar, and
thence to an integer, but I have a funny feeling that if you do reference
counting might destroy it after the cast but before the sendmessage
completes. I haven't looked to see whether that may happen, so unless
someone else is kind enough to investigate, I suggest you do things the long
way and copy the string:
var p: PChar;
GetMem(p, Length(MyString) + 1);
try
StrPCopy(p, MyString);
SendMessage(GetDlgItem(hdlg, DLG_HELPSIZE), CB_ADDSTRING, 0,
Integer(p));
finally
FreeMem(p);
end;
Cheers,
Carl
-----Original Message-----
From: Jason L. Coley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 7 February 2001 12:31 PM
To: Multiple recipients of list delphi
Subject: [DUG]: SendMessage and strings
Hi,
I still haven't got this working yet, I still cannot send a string using
the SendMessage command, so can anyone help me, I need it to add strings
to a combo box in a properties dialog.
How do I send a string as the lparam in the sendmessage command?
SendMessage(GetDlgItem(hdlg, DLG_HELPSIZE), CB_ADDSTRING, 0,
MyString);
Regards
>Jason Coley
>Manawatu Software Solutions
>http://www.software-solutions.co.nz
<http://www.software-solutions.co.nz/>
---------------------------------------------------------------------------
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"