Closed zhao0876 closed 1 year ago
LVITEM
is a class, so it has to be pinned in memory before passing to SendMessage
.
var item = new LVITEM(row);
using var pitem = new PinnedObject(item);
var result = SendMessage(hwnd, ListViewMessage.LVM_GETITEMTEXT, (IntPtr)row, pitem);
When I use the SendMessage command to send something similar to ListViewMessage. LVM_GETITEMTEXT instruction Based on the help, I attempted to specify an LVITEM object for IParam to receive the results However, SendMessage provides the following error prompt:
CS0453: Type 'ComCtl32. LVITEM' must be a non nullable value type in order to be used as parameter 'TLP' in a generic type or method User32. SendMessage(HWND, TMsg, nint, TLP)
Does it need to provide a pointer to an LVITEM object as a parameter? I saw in other searches that the memory pointed to by this pointer needs to be created within the target program, is this also the case in Vanara? Anyway, I hope to get a valid example of sending ListViewMessage.
What code is involved