SDK中如何响应TREEVIEW节点双击事件 - C++ Builder / Windows SDK/API
BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { //BEGIN MESSAGE CRACK HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog); HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand); HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose); case WM_NOTIFY:
int i=0; for(i;i<=10;i++) { TCHAR x[256]; ZeroMemory(x,sizeof(x)/sizeof(TCHAR)); wsprintf(x,TEXT("第%d项"),i); inittree(hwnd,x); }void inittree(HWND hwnd,LPCSTR lpcstr){ HWND hwndctrl=GetDlgItem(hwnd,IDC_TRV1); HINSTANCE hinst=(HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE); TVINSERTSTRUCT tvi; tvi.item.mask = TVIF_TEXT | TVIF_IMAGE |TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.hInsertAfter = TVI_LAST; tvi.hParent = TVI_ROOT; tvi.hParent = NULL; tvi.item.pszText =(CHAR*) lpcstr; TreeView_InsertItem(hwndctrl,&tvi);}