Ok, I've done my own listview edit box for editing subitems and such before, but I can't get it positioned right this time around. Last time, all I did was use LVM_GETSUBITEMRECT and position the edit box accordingly. This time, however, the listview is inside a groupbox on a tab. LVM_GETSUBITEMRECT isn't getting me what I need anymore. The damn edit box appears way outside the listview and groupbox. This is confusing as hell.
Code:
case LSV_CS_BEGINEDIT:
{
if (lvExEditedItem.Status) { MessageBox(NULL,"Already editing. WTF? (LSV_BEGINEDIT)","Error",0); break; }
if (HIWORD(lParam) <= 0) { break; }
char txtInput[20];
LV_ITEM lvItem; memset(&lvItem,0,sizeof(lvItem));
lvItem.iItem = LOWORD(lParam);
lvItem.iSubItem = HIWORD(lParam);
lvExEditedItem.iItem = lvItem.iItem;
lvExEditedItem.iSubItem = lvItem.iSubItem;
RECT lvEditRect; memset(&lvEditRect,0,sizeof(lvEditRect));
lvEditRect.top = lvItem.iSubItem;
lvEditRect.left = LVIR_LABEL;
SendMessage(hExSearchList, LVM_GETSUBITEMRECT, lvItem.iItem, (LPARAM)&lvEditRect);
SendMessage(hExEdit, EM_SETLIMITTEXT, 8, 0);
lvItem.pszText=txtInput;
lvItem.cchTextMax=sizeof(txtInput);
SendMessage(hExSearchList, LVM_GETITEMTEXT, lvItem.iItem, (LPARAM)&lvItem);
SetWindowText(hExEdit,lvItem.pszText);
SetWindowPos(hExEdit,HWND_TOP,lvEditRect.left+3,lvEditRect.top+1,(lvEditRect.right-lvEditRect.left),(lvEditRect.bottom-lvEditRect.top)+1,SWP_SHOWWINDOW);
SetFocus(hExEdit);
SendMessage(hExEdit, EM_SETSEL, 0, -1);
lvExEditedItem.Status = 1;
} break;
EDIT: I think I solved it.