On Tue, Feb 16, 2010 at 3:57 PM, Jolyon Smith <jsm...@deltics.co.nz> wrote: > Good luck with GetLastError(). There's nothing to indicate that > LB_GETITEMDATA processing will set a Windows "LastError". > > And empirically I would have to say that it doesn't:
Hmm... empirically I would have to say it does. type TIPRListBox = class(TListBox); procedure TForm1.Button1Click(Sender: TObject); function GetValue(AListBox: TListBox; AIndex: Integer): Integer; begin Result := TIPRListBox(AListBox).GetItemData(AIndex); if GetLastError <> 0 then RaiseLastOSError; end; begin ListBox1.Items.AddObject('foo', TObject(0)); ListBox1.Items.AddObject('foo', TObject(-1)); ShowMessage(IntToStr(GetValue(ListBox1, 0))); ShowMessage(IntToStr(GetValue(ListBox1, 1))); ShowMessage(IntToStr(GetValue(ListBox1, 2))); end; Tested results: 0, -1, <invalid index error> I'm using D2006, and you? Cheers, Karl _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe