16,471
社区成员
发帖
与我相关
我的任务
分享
if(((LPNMHDR)lParam)->code == NM_DBLCLK) //user has Double clicked the left mouse button within the control
{
__wchar_t Text[255]= L"";
memset(&tvi,0,sizeof(tvi));
Selected=(HTREEITEM)SendDlgItemMessage(hWnd,IDC_TREE1,TVM_GETNEXTITEM,TVGN_CARET,(LPARAM)Selected);
if(Selected==NULL)
{
MessageBox(hWnd,L"No Items in TreeView",L"Error",MB_OK|MB_ICONINFORMATION);
break;
}
TreeView_EnsureVisible(hWnd,Selected);
SendDlgItemMessage(hWnd,IDC_TREE1,TVM_SELECTITEM,TVGN_CARET,(LPARAM)Selected);
flagSelected = true;
tvi.mask=TVIF_TEXT;
tvi.pszText = Text;
tvi.cchTextMax = 256;
tvi.hItem = Selected;
if(SendDlgItemMessage(hWnd,IDC_TREE1,TVM_GETITEM,TVGN_CARET,(LPARAM)&tvi))
{
// convert LPWSTR to char
char temp[550];
wcstombs(temp, tvi.pszText, 550);
if(tvi.cChildren==0 && strcmp(temp,"Double Click Me!")==0)
{
//MessageBox(hWnd,L"Press OK to delete me!",L"Example",MB_OK|MB_ICONINFORMATION);
//SendDlgItemMessage(hWnd,IDC_TREE1,TVM_DELETEITEM,TVGN_CARET,(LPARAM)tvi.hItem);
//flagSelected=false;
//break;
/* hWndComboBox = */
//point.x = LOWORD(lParam);
//point.y = HIWORD(lParam);
//GetCursorPos(&point);
/*CreateWindow(L"COMBOBOX",
NULL,
WS_CHILD | WS_VISIBLE,
point.x - 30 , point.y - 25, 100, 60,
hWnd,
NULL,
hInst,
NULL);*/
RECT point1;
TreeView_GetItemRect(hWnd,Selected,&point1,true);
CreateWindow(L"COMBOBOX",
NULL,
WS_CHILD | WS_VISIBLE,
point1.left , point1.top, point1.right - point1.left, point1.bottom - point1.top,
hWnd,
NULL,
hInst,
NULL);
break;
}
}
}