selected item in a list
I'm trying to programmatically select item in a listbox in another program. I figured out the handle to the listbox but I'm having trouble selecting the items in the listbox. I have tried this so far and this doesnt seem to work. Can anyone help me out w/ whats wrong by fixing my code or proposing a new way to tackle this. //I believe this doesnt change the state of the item so I tried: IntPtr pointer1= Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LV_ITEM)));
//I'm trying to setselectionmark to 11th item in the list.
SendMessage(tester1,LVM_SETSELECTIONMARK,0,10);
Marshal.StructureToPtr(lvItem,pointer1,true);
lvItem.stateMask=LVIS_SELECTED | LVIS_FOCUSED;
SendMessage(tester1,LVM_SETITEMSTATE,10,pointer1);
Marshal.FreeHGlobal(pointer1);

