|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Selecting ListView item with Windows Messageand LVM_SETITEMSTATE windows message .... hWnd = listView.handle; index = -1; .... LVITEM lvItem = new LVITEM(); lvItem.mask = LVIF_STATE; lvItem.stateMask = LVIS_SELECTED; lvItem.state = LVIS_SELECTED; IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LVITEM))); Marshal.StructureToPtr(lvItem, pointer, true); SendMessage(hWnd, LVM_SETITEMSTATE, index, pointer); Marshal.FreeHGlobal(pointer); .... but this code doesn't work as it should... it selects all items for a short while, but only after I click ListView control with my mouse which of course move selection to the item I click on what can be wrong? (please do not suggest other way of selecting items - I want to do that with LVM_SETITEMSTATE message) Hi Koala,
Just a though, is the ListBox set to display selected items when it doesn't have focus? -- Happy Coding! Morten Wennevik [C# MVP] |
|||||||||||||||||||||||