thanks
![embarassed :oops:](./images/smilies/icon_redface.gif)
Code: Select all
function InsertLvItem(const hLv: DWORD; lpText: PChar; dwIndex: DWORD): BOOL;
var
lvi: ^LV_ITEM;
const
dwSz = sizeof(lvi^);
begin
lvi := VirtualAlloc(nil, dwSz, MEM_COMMIT, PAGE_READWRITE);
lvi^.mask := LVIF_TEXT;
lvi^.pszText := lpText;
lvi^.iSubItem := 0;
lvi^.iItem := dwIndex;
result := ListView_InsertItem(hLv, lvi^) <> -1;
VirtualFree(lvi, 0, MEM_RELEASE);
end;
Code: Select all
if InsertLvItem(Lv.Handle, 'Item 1', 0) then
MessageBox(0, 'Item Inserted Successfully',
'Information', (MB_OK or MB_ICONINFORMATION or MB_TOPMOST or MB_SETFOREGROUND));