void CPlayListDlg::OnInitDialog(HWND hwndDlg) { m_hWnd = hwndDlg; ShellInitDialog(m_hWnd); HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST); RECT rc; GetClientRect(hwndLV, &rc); ListView_SetExtendedListViewStyle(hwndLV, ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT); // カラムの挿入 LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_LEFT; lvc.cx = RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - 2; lvc.pszText = _T("Name"); lvc.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvc); // イメージリストを設定 ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL); // リストを更新 UpdatePlayList(); }
void CPlayListDlg::OnInitDialog(HWND hwndDlg) { m_hWnd = hwndDlg; ShellInitDialog(m_hWnd); // ツールバーの準備 SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = m_hWnd; mbi.nToolBarId = IDR_PLAYLIST; mbi.hInstRes = GetInst(); SHCreateMenuBar(&mbi); m_hwndMB = mbi.hwndMB; // リストの準備 HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST); ListView_SetExtendedListViewStyle(hwndLV, ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT); // カラムの挿入 LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_LEFT; lvc.cx = 0; lvc.pszText = _T("Name"); lvc.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvc); // イメージリストを設定 ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL); // リストを更新 UpdatePlayList(); }
void CPlayListDlg::OnInitDialog(HWND hwndDlg) { m_hWnd = hwndDlg; ShellInitDialog(m_hWnd); // ツールバーの準備 SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = m_hWnd; mbi.nToolBarId = IDR_DUMMY; mbi.hInstRes = GetInst(); SHCreateMenuBar(&mbi); m_hwndMB = mbi.hwndMB; SendMessage(m_hwndMB, TB_DELETEBUTTON, 0, 0); SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_UP); SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_DOWN); CommandBar_AddBitmap(m_hwndMB, GetInst(), IDR_PLAYLIST, 6, 16, 16); TBBUTTON tbbMain[] = { {0, IDC_ADD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, {1, IDC_UP, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 0}, {2, IDC_DOWN, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 1}, {3, IDC_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, {4, IDC_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1}, {5, IDC_CTRLKEY, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0, 0, -1} }; for (int i = 0; i < sizeof(tbbMain) / sizeof(TBBUTTON); i++) { CommandBar_InsertButton(m_hwndMB, i, &tbbMain[i]); } // リストの準備 HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST); ListView_SetExtendedListViewStyle(hwndLV, ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT); // カラムの挿入 LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; lvc.fmt = LVCFMT_LEFT; lvc.cx = 0; lvc.pszText = _T("Name"); lvc.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvc); // イメージリストを設定 ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL); // リストを更新 UpdatePlayList(); }
void CFolderDlg::OnInitDialog(HWND hDlg) { CTempStr str(IDS_ROOT_FOLDER_NAME); ShellInitDialog(hDlg); HWND hTreeView = GetDlgItem(hDlg, IDC_TREE_FOLDER); m_bRefresh = FALSE; m_hImageList = NULL; HICON hIcon; //イメージリスト作成 m_hImageList = ImageList_Create(SCALEX(16), SCALEY(16), ILC_COLOR|ILC_MASK, 1, 2); hIcon = (HICON)LoadImage(GetInst(), (LPCTSTR)IDI_ROOT, IMAGE_ICON, SCALEX(16), SCALEY(16), 0); ImageList_AddIcon(m_hImageList, hIcon); DeleteObject(hIcon); SHFILEINFO shfi; SHGetFileInfo(_T("\\Windows"), NULL, &shfi, sizeof(shfi), SHGFI_SMALLICON | SHGFI_ICON); ImageList_AddIcon(m_hImageList, shfi.hIcon); TreeView_SetImageList(hTreeView, m_hImageList, TVSIL_NORMAL); SetWindowLong(hTreeView, GWL_STYLE, GetWindowLong(hTreeView, GWL_STYLE)|TVS_HASBUTTONS|TVS_HASLINES|TVS_SHOWSELALWAYS); //フォルダ読み込み HCURSOR hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT)); TVINSERTSTRUCT tvis; tvis.hParent = NULL; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN; tvis.item.pszText = str; tvis.item.iImage = 0; tvis.item.iSelectedImage = 0; tvis.item.cChildren = 1; HTREEITEM hRoot = TreeView_InsertItem(hTreeView, &tvis); TreeView_Expand(hTreeView, hRoot, TVE_EXPAND); //カレントフォルダをセット SetCurrentFolder(hTreeView, m_pszPath); if (m_bSubFolder) SendMessage(GetDlgItem(hDlg, IDC_CHECK_SUBFOLDER), BM_SETCHECK, 1, 0); SetCursor(hCursor); }