listview加一列 显示手机号码<br>procedure TMainForm.LoadItems(RememberSelected: Boolean);<br>const<br> TableColumns: record // SizedSPropTagArray macro<br> Count: ULONG;<br> Definition: array[0..5] of ULONG;<br> end = (<br> Count: 6;<br> Definition:<br> (PR_DISPLAY_NAME,<br> PR_EMAIL_ADDRESS,<br> PR_PERSONAL_HOME_PAGE,<br> PR_ENTRYID,<br> PR_OBJECT_TYPE,<br> PR_MOBILE_TELEPHONE_NUMBER);<br>  
;<br>var<br> Container: IABContainer;<br> EntryID: PEntryID;<br> EntryIDSize, ObjType: ULONG;<br> Table: IMAPITable;<br> TableRow: PSRowSet;<br> EntryIDData: PSBinary;<br> Item, LastSelectedItem: TListItem;<br><br>function IsLastDetailItem: Boolean;<br>var<br> Res: ULONG;<br>begin<br> Result := (FLastDetailID <> nil) and RememberSelected;<br> if not Result then Exit;<br> with FLastDetailID^ do<br> OleCheck(AddrBook.CompareEntryIDs(EntryIDSize, EntryID, cb, PEntryID(lpb), 0, Res));<br> Result := Res <> 0;<br>end;<br><br>begin<br> LastSelectedItem := nil;<br><br> OleCheck(AddrBook.GetPAB(EntryIDSize, EntryID));<br> OleCheck(AddrBook.OpenEntry(EntryIDSize, EntryID, nil, 0,<br> ObjType, IUnknown(Container)));<br> OleCheck(WabObject.FreeBuffer(EntryID));<br><br> OleCheck(Container.GetContentsTable(0, Table));<br> OleCheck(Table.SetColumns(@TableColumns, 0));<br> OleCheck(Table.SeekRow(BOOKMARK_BEGINNING, 0, nil));<br><br> with AdrBookListView do<br> begin<br> Items.BeginUpdate;<br> try<br> Items.Clear;<br> repeat<br> OleCheck(Table.QueryRows(1, 0, TableRow));<br> if TableRow.cRows > 0 then with TableRow^.aRow[0] do<br> begin<br> if ULONG(lpProps[4].Value.l) in [MAPI_MAILUSER, MAPI_DISTLIST] then<br> begin<br> EntryID := lpProps[3].Value.bin.lpb;<br> EntryIDSize := lpProps[3].Value.bin.cb;<br><br> OleCheck(WabObject.AllocateBuffer(Sizeof(TSBinary), Pointer(EntryIDData)));<br> OleCheck(WabObject.AllocateMore(EntryIDSize, EntryIDData, Pointer(EntryIDData.lpb)));<br> CopyMemory(EntryIDData.lpb, EntryID, EntryIDSize);<br> EntryIDData^.cb := EntryIDSize;<br><br> Item := Items.Add;<br> with Item do<br> begin<br> Caption := SPropValueToStr(lpProps[0]);<br> SubItems.Add(SPropValueToStr(lpProps[1]));<br> SubItems.Add(SPropValueToStr(lpProps[2]));<br> SubItems.Add(SPropValueToStr(lpProps[5]));<br> Data := EntryIDData;<br> case ULONG(lpProps[4].Value.l) of<br> MAPI_MAILUSER:<br> ImageIndex := imgIndexUser;<br> MAPI_DISTLIST:<br> ImageIndex := imgIndexDL;<br> end;