Sorry if I was slow to reply, but email has been down here since I last sent
that message.
From: Jason L. Coley [mailto:[EMAIL PROTECTED]]
> I tried this one and it didn't work, does this help make any difference
> to how I send the string, it mentions the string has to be a long
> pointer to a null-terminated string. So a long pointer to a Pchar, also
> if I make a Pchar, will that need to be in memory for the life of the
> dialog, or just long enough to populate the combo box?
When the Windows API help talks about null-terminated strings, they really
mean consecutive characters in memory, with a #0 on the end. Keeping that
in mind, a PChar *is* a long pointer to a null-terminated string. So they
just want a PChar.
But on reflection, you don't really need to copy the string. Passing it
into a function as a const parameter will ensure safety. So use this:
uses Consts;
procedure AddStringToCombo(AHandle: HWnd; const AString: string; AIndex:
Integer);
begin
if SendMessage(AHandle, CB_INSERTSTRING, AIndex,
Longint(PChar(AString))) < 0 then
raise EOutOfResources.Create(SInsertLineError);
end;
and
AddStringToComboBox(GetDlgItem(hdlg, DLG_HELPSIZE), p, 0);
And if that doesn't work it's because GetDlgItem didn't.
Cheers,
Carl
---------------------------------------------------------------------------
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"