Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: ListView Item Text herausfinden
20. Jan 2008, 12:31
Aus meinem RunAsUser:
Delphi-Quellcode:
function GetLVItemData(var AppData: TAppData): Integer;
var
Index : Integer;
lvi : TLVItem;
Buffer : PChar;
begin
Index := SendDlgItemMessage(hApp, IDC_LV, LVM_GETSELECTIONMARK, 0, 0);
if Index > -1 then
begin
FillChar(lvi, sizeof(lvi), #0);
GetMem(Buffer, 255);
try
// which item is selcted?
lvi.iItem := SendDlgItemMessage(hApp, IDC_LV, LVM_GETNEXTITEM, -1,
LVNI_SELECTED);
// retrieve item data
lvi.Mask := LVIF_TEXT or LVIF_STATE;
lvi.iSubItem := 2;
lvi.pszText := Buffer;
lvi.cchTextMax := 256;
SendDlgItemMessage(hApp, IDC_LV, LVM_GETITEM, 0, Integer(@lvi));
AppData.Path := string(Buffer);
lvi.iSubItem := 0;
SendDlgItemMessage(hApp, IDC_LV, LVM_GETITEM, 0, Integer(@lvi));
AppData.Description := Buffer;
lvi.iSubItem := 1;
SendDlgItemMessage(hApp, IDC_LV, LVM_GETITEM, 0, Integer(@lvi));
AppData.User := Buffer;
lvi.iSubItem := 3;
SendDlgItemMessage(hApp, IDC_LV, LVM_GETITEM, 0, Integer(@lvi));
AppData.Params := Buffer;
finally
FreeMem(Buffer, 255);
end;
end;
result := Index;
end;
@Sirius: Was ist gegen SendDlgItemMessage einzuwenden?
Michael Ein Teil meines Codes würde euch verunsichern.
|
|
Zitat
|