BOOL CALLBACK CPlayListDlg::PlayListDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static CPlayListDlg* pDlg; switch (uMsg) { case WM_INITDIALOG: pDlg = (CPlayListDlg*)lParam; pDlg->OnInitDialog(hwndDlg); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: pDlg->Close(); return TRUE; case IDOK: case IDM_PLAY_SELECTED: pDlg->OnOK(); return TRUE; case IDC_DELETE: case IDM_FILE_DELETE: pDlg->OnDelete(); return TRUE; case IDC_UP: case IDM_FILE_UP: pDlg->OnUp(); return TRUE; case IDC_DOWN: case IDM_FILE_DOWN: pDlg->OnDown(); return TRUE; case IDC_ADD: pDlg->OnAdd(); return TRUE; case IDC_SAVE: pDlg->OnSave(); return TRUE; case IDC_CTRLKEY: pDlg->OnCtrlKey(); return TRUE; case IDM_FILE_SORT_BYNAME: case IDM_FILE_SORT_BYPATH: pDlg->OnSort(LOWORD(wParam)); return TRUE; } return FALSE; case WM_CLOSE: pDlg->Close(); return TRUE; case WM_DESTROY: pDlg->m_hWnd = NULL; return TRUE; case WM_MOVE: pDlg->OnMove(LOWORD(lParam), HIWORD(lParam)); return TRUE; case WM_NOTIFY: { NMHDR* pnmh = (NMHDR*)lParam; switch (pnmh->code) { case LVN_KEYDOWN: pDlg->OnListKeyDown((NMLVKEYDOWN*)pnmh); return TRUE; case NM_DBLCLK: pDlg->OnListDblClk(pnmh); return TRUE; case LVN_BEGINDRAG: pDlg->OnListBeginDrag((NMLISTVIEW*)pnmh); return TRUE; case NM_RETURN: pDlg->OnOK(); return TRUE; case GN_CONTEXTMENU: pDlg->OnContextMenu((NMRGINFO*)pnmh); return TRUE; } return FALSE; } case WM_MOUSEMOVE: pDlg->OnMouseMove((short)LOWORD(lParam), (short)HIWORD(lParam)); return TRUE; case WM_LBUTTONUP: case WM_RBUTTONUP: pDlg->OnLButtonUp(); return TRUE; case WM_CTLCOLORSTATIC: return DefDlgCtlColorStaticProc(hwndDlg, wParam, lParam); case WM_SIZE: { RECT rc; HWND hwnd; POINT pt; hwnd = GetDlgItem(hwndDlg, IDC_PLAY_LIST); GetWindowRect(hwnd, &rc); pt.x = rc.left; pt.y = rc.top; ScreenToClient(hwndDlg, &pt); MoveWindow(hwnd, pt.x, pt.y, LOWORD(lParam) - pt.x * 2, HIWORD(lParam) - pt.y - pt.x, TRUE); GetWindowRect(hwnd, &rc); SendMessage(hwnd, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - GetSystemMetrics(SM_CXBORDER) * 2, 0)); } case WM_INITMENUPOPUP: pDlg->OnInitMenuPopup((HMENU)wParam); return TRUE; default: return FALSE; } }
BOOL CALLBACK CPlayListDlg::PlayListDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static CPlayListDlg* pDlg; switch (uMsg) { case WM_INITDIALOG: pDlg = (CPlayListDlg*)lParam; pDlg->OnInitDialog(hwndDlg); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: //DestroyWindow(hwndDlg); ShowWindow(hwndDlg, SW_HIDE); return TRUE; case IDOK: case IDM_PLAY_SELECTED: pDlg->OnOK(); return TRUE; case IDC_DELETE: case IDM_FILE_DELETE: pDlg->OnDelete(); return TRUE; case IDC_UP: case IDM_FILE_UP: pDlg->OnUp(); return TRUE; case IDC_DOWN: case IDM_FILE_DOWN: pDlg->OnDown(); return TRUE; case IDC_ADD: pDlg->OnAdd(); return TRUE; case IDC_SAVE: pDlg->OnSave(); return TRUE; case IDM_FILE_SORT_BYNAME: case IDM_FILE_SORT_BYPATH: pDlg->OnSort(LOWORD(wParam)); return TRUE; } return FALSE; case WM_CLOSE: //DestroyWindow(hwndDlg); ShowWindow(hwndDlg, SW_HIDE); return TRUE; case WM_DESTROY: pDlg->m_hWnd = NULL; return TRUE; case WM_MOVE: pDlg->OnMove(LOWORD(lParam), HIWORD(lParam)); return TRUE; #ifndef _WIN32_WCE case WM_DROPFILES: pDlg->OnDropFiles((HDROP)wParam); return TRUE; #endif case WM_NOTIFY: { NMHDR* pnmh = (NMHDR*)lParam; switch (pnmh->code) { case LVN_KEYDOWN: pDlg->OnListKeyDown((NMLVKEYDOWN*)pnmh); return TRUE; case NM_DBLCLK: pDlg->OnListDblClk(pnmh); return TRUE; case LVN_BEGINDRAG: pDlg->OnListBeginDrag((NMLISTVIEW*)pnmh); return TRUE; case NM_RCLICK: pDlg->OnListRClick(pnmh); return TRUE; case NM_CLICK: pDlg->OnListClick(pnmh); return TRUE; } return FALSE; } case WM_MOUSEMOVE: pDlg->OnMouseMove((short)LOWORD(lParam), (short)HIWORD(lParam)); return TRUE; case WM_LBUTTONUP: case WM_RBUTTONUP: pDlg->OnLButtonUp(); return TRUE; case WM_PAINT: return DefDlgPaintProc(hwndDlg, wParam, lParam); case WM_CTLCOLORSTATIC: return DefDlgCtlColorStaticProc(hwndDlg, wParam, lParam); default: return FALSE; } }
LRESULT CALLBACK CFolderDlg::FolderDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static CFolderDlg* pDlg; switch (message) { case WM_INITDIALOG: { pDlg = (CFolderDlg*)lParam; pDlg->OnInitDialog(hDlg); return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDOK : { pDlg->OnOK(hDlg); return TRUE; } case IDCANCEL: { pDlg->OnCancel(hDlg); return TRUE; } } break; } case WM_NOTIFY: { NMHDR* lpnmh = (NMHDR*)lParam; if (lpnmh->code == TVN_ITEMEXPANDING) { pDlg->OnItemExpanding((NMTREEVIEW*)lpnmh); return TRUE; } else if (lpnmh->code == TVN_ITEMEXPANDED) { pDlg->OnItemExpanded((NMTREEVIEW*)lpnmh); return TRUE; } break; } //case WM_PAINT: // return DefDlgPaintProc(hDlg, wParam, lParam); case WM_CTLCOLORSTATIC: return DefDlgCtlColorStaticProc(hDlg, wParam, lParam); #ifdef _WIN32_WCE_PPC case WM_SIZE: { RECT rc; HWND hwnd; POINT pt; #define CHECK_HEIGHT SCALEY(22) #define CHECK_MARGIN SCALEY(2) hwnd = GetDlgItem(hDlg, IDCANCEL); GetWindowRect(hwnd, &rc); pt.x = rc.left; pt.y = rc.top; ScreenToClient(hDlg, &pt); MoveWindow(hwnd, LOWORD(lParam) - RECT_WIDTH(&rc) - 2, pt.y, RECT_WIDTH(&rc), RECT_HEIGHT(&rc), TRUE); hwnd = GetDlgItem(hDlg, IDC_TREE_FOLDER); GetWindowRect(hwnd, &rc); pt.x = rc.left; pt.y = rc.top; ScreenToClient(hDlg, &pt); MoveWindow(hwnd, pt.x, pt.y, LOWORD(lParam) - pt.x * 2, HIWORD(lParam) - pt.y - (CHECK_HEIGHT + CHECK_MARGIN * 2), TRUE); hwnd = GetDlgItem(hDlg, IDC_CHECK_SUBFOLDER); GetWindowRect(hwnd, &rc); pt.x = rc.left; pt.y = rc.top; ScreenToClient(hDlg, &pt); MoveWindow(hwnd, pt.x, HIWORD(lParam) - (CHECK_HEIGHT + CHECK_MARGIN), RECT_WIDTH(&rc), CHECK_HEIGHT, TRUE); return TRUE; } #endif } return FALSE; }