VOID ArgumentInsertArgument( IN HWND hWnd, IN PPSP_PROBE Probe ) { HWND hWndCtrl; LVCOLUMN Column = {0}; BTR_ARGUMENT Argument; ULONG i; hWndCtrl = GetDlgItem(hWnd, IDC_LIST_ARGUMENT); ListView_SetUnicodeFormat(hWndCtrl, TRUE); ListView_SetExtendedListViewStyleEx(hWndCtrl, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); Column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; for (i = 0; i < 2; i++) { Column.iSubItem = i; Column.pszText = ArgumentColumn[i].Title; Column.cx = ArgumentColumn[i].Width; Column.fmt = ArgumentColumn[i].Align; ListView_InsertColumn(hWndCtrl, i, &Column); } if (Probe != NULL && Probe->Current != ProbeCreating) { for(i = 0; i < Probe->ArgumentCount; i++) { LVITEM Item = {0}; Item.mask = LVIF_TEXT; Item.iItem = i; Item.iSubItem = 0; Argument = Probe->Parameters[i]; Item.pszText = ArgumentType[Argument]; ListView_InsertItem(hWndCtrl, &Item); Item.iSubItem = 1; Item.pszText = &Probe->ParameterName[i][0]; ListView_SetItem(hWndCtrl, &Item); } } }
int CMidiTargetDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CChildDlg::OnCreate(lpCreateStruct) == -1) return -1; DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | LVS_OWNERDATA; if (!m_List.Create(dwStyle, CRect(0, 0, 0, 0), this, IDC_MIDI_TARGET_LIST)) return -1; m_List.SendMessage(WM_SETFONT, WPARAM(GetStockObject(DEFAULT_GUI_FONT))); // force list to send appropriate notifications for our character size ListView_SetUnicodeFormat(m_List.m_hWnd, sizeof(TCHAR) == sizeof(WCHAR)); // increase item height to accomodate popup edit controls; // temporarily enable checkbox style to get appropriate height DWORD dwListExStyle = LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT; m_List.SetExtendedStyle(dwListExStyle | LVS_EX_CHECKBOXES); // add checkbox style m_List.ModifyStyle(0, LVS_OWNERDRAWFIXED); // add owner draw style m_List.MoveWindow(0, 0, 0, 1); // force list to send WM_MEASUREITEM m_List.SetExtendedStyle(dwListExStyle); // remove checkbox style m_List.MoveWindow(0, 0, 0, 0); // force list to send WM_MEASUREITEM again m_List.ModifyStyle(LVS_OWNERDRAWFIXED, 0); // remove owner draw style return 0; }
ULONG PerfInsertCounterList( IN PDIALOG_OBJECT Object, IN HWND hWnd ) { HWND hWndCounters; LVCOLUMN Column = {0}; LVITEM item = {0}; int i; UNREFERENCED_PARAMETER(Object); hWndCounters = GetDlgItem(hWnd, IDC_LIST_PERF_COUNTERS); ListView_SetUnicodeFormat(hWndCounters, TRUE); ListView_SetExtendedListViewStyleEx(hWndCounters, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); Column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; for(i = 0; i < PERF_COLUMN_NUMBER; i++) { Column.iSubItem = i; Column.pszText = PerfColumn[i].Title; Column.cx = PerfColumn[i].Width; Column.fmt = PerfColumn[i].Align; ListView_InsertColumn(hWndCounters, i, &Column); } // // PerfCounterCpuTotal // item.mask = LVIF_TEXT; item.iItem = PerfCounterCpuTotal; item.iSubItem = PerfColumnCounter; item.pszText = L"CPU Usage"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterPrivateBytes // item.iItem = PerfCounterPrivateBytes; item.iSubItem = PerfColumnCounter; item.pszText = L"Private Bytes"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterWorkingSet // item.iItem = PerfCounterWorkingSet; item.iSubItem = PerfColumnCounter; item.pszText = L"Working Set"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterKernelHandles // item.iItem = PerfCounterKernelHandles; item.iSubItem = PerfColumnCounter; item.pszText = L"Kernel Handles"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterUserHandles // item.iItem = PerfCounterUserHandles; item.iSubItem = PerfColumnCounter; item.pszText = L"User Handles"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterGdiHandles // item.iItem = PerfCounterGdiHandles; item.iSubItem = PerfColumnCounter; item.pszText = L"Gdi Handles"; ListView_InsertItem(hWndCounters, &item); // // PerfCounterIoTotal // item.iItem = PerfCounterIoTotal; item.iSubItem = PerfColumnCounter; item.pszText = L"I/O Total"; ListView_InsertItem(hWndCounters, &item); return S_OK; }
LRESULT FilterOnInitDialog( IN HWND hWnd, IN UINT uMsg, IN WPARAM wp, IN LPARAM lp ) { WCHAR Buffer[MAX_PATH]; WCHAR Format[MAX_PATH]; HWND hWndStatic; PBSP_PROCESS Process; PDIALOG_OBJECT Object; PFILTER_CONTEXT Context; HWND hWndTree; HWND hWndList; RECT ListRect, TreeRect; LVCOLUMN Column = {0}; PLISTVIEW_OBJECT ListObject; int i; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, FILTER_CONTEXT); hWndList = GetDlgItem(hWnd, IDC_LIST_FILTER); hWndTree = GetDlgItem(hWnd, IDC_TREE_FILTER); GetWindowRect(hWndList, &ListRect); GetWindowRect(hWndTree, &TreeRect); // // Initialize splitbar information // Context->SplitbarBorder = ListRect.left - TreeRect.right; Context->SplitbarLeft = 0; Context->DragMode = FALSE; // // Insert list control columns // ListView_SetUnicodeFormat(hWndList, TRUE); ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); ListView_SetExtendedListViewStyleEx(hWndList, LVS_EX_INFOTIP, LVS_EX_INFOTIP); Column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; for (i = 0; i < 2; i++) { Column.iSubItem = i; Column.pszText = FilterColumn[i].Title; Column.cx = FilterColumn[i].Width; Column.fmt = FilterColumn[i].Align; ListView_InsertColumn(hWndList, i, &Column); } ListObject = (PLISTVIEW_OBJECT)SdkMalloc(sizeof(LISTVIEW_OBJECT)); ListObject->hWnd = hWndList; ListObject->Column = FilterColumn; ListObject->Count = 2; ListObject->SortOrder = SortOrderDescendent; ListObject->LastClickedColumn = 0; Context->ListObject = ListObject; // // Subclass list control to get chance to handle WM_CHAR, WM_KEYDOWN // keyboard events. // SetWindowSubclass(hWndList, FilterListProcedure, 0, 0); // // Insert filter and its functions // FilterInsertFilter(Object); hWndStatic = GetDlgItem(hWnd, IDC_STATIC); LoadString(SdkInstance, IDS_FILTER_SELECT, Format, MAX_PATH); StringCchPrintf(Buffer, MAX_PATH, Format, Context->NumberOfSelected); SetWindowText(hWndStatic, Buffer); Process = Context->Process; LoadString(SdkInstance, IDS_FILTER_TITLE, Format, MAX_PATH); StringCchPrintf(Buffer, MAX_PATH, Format, Process->Name, Process->ProcessId); SetWindowText(hWnd, Buffer); SdkSetMainIcon(hWnd); if (Context->NumberOfSelected != 0) { ListViewSelectSingle(hWndList, 0); SetFocus(hWndList); } return TRUE; }
void buildCertificatesList(HWND hwnd) { RECT rect; HWND certificatesList; LV_COLUMN lvC; certificatesList = GetDlgItem(hwnd, IDC_CERTIFICATESLIST); ListView_SetUnicodeFormat(certificatesList, true); GetClientRect(certificatesList, &rect); int rectWidth = rect.right - rect.left; int colSize = rectWidth/6; int colWidths[] = {3 * colSize, 2 * colSize, colSize + (rectWidth - (6*colSize)), 0}; int colTitles[] = {IDS_CERTIFICATEHEADER, IDS_TYPEHEADER, IDS_VALIDUNTILHEADER, IDS_EMPTY}; ListView_SetExtendedListViewStyle(certificatesList, LVS_EX_FULLROWSELECT); lvC.mask = LVCF_WIDTH | LVCF_TEXT; lvC.fmt = LVCFMT_LEFT; TCHAR header[32]; for(int index = 0; index < 4; index++) { lvC.iSubItem = index; lvC.cx = colWidths[index]; LoadString(pluginInstance, colTitles[index], header, sizeof(header)/sizeof(TCHAR)); lvC.pszText = header;//colTitles[index]; ListView_InsertColumn(certificatesList, index, &lvC); } LV_ITEM lv; lv.mask = LVIF_TEXT; EstEID_Certs *certs = EstEID_loadCerts(); EstEID_log("reading certs @ %p, certs->count = %u ", certs, certs->count); TCHAR unicodeBuf[512]; int currentCertIndex = 0; for (int i = 0; i < certs->count; i++) { EstEID_Map cert = certs->certs[i]; if (!EstEID_mapGet(cert, "usageNonRepudiation")) { continue; } lv.iSubItem = 0; lv.iItem = currentCertIndex; MultiByteToWideChar(CP_UTF8, 0, EstEID_mapGet(cert, "commonName"), -1, unicodeBuf, sizeof(unicodeBuf) / sizeof(TCHAR)); lv.pszText = (LPWSTR)unicodeBuf; ListView_InsertItem(certificatesList, &lv); MultiByteToWideChar(CP_UTF8, 0, EstEID_mapGet(cert, "organizationName"), -1, unicodeBuf, sizeof(unicodeBuf) / sizeof(TCHAR)); ListView_SetItemText(certificatesList, currentCertIndex, 1, unicodeBuf); char* validTo = getDateFromDateTime(EstEID_mapGet(cert, "validTo")); MultiByteToWideChar(CP_UTF8, 0, validTo, -1, unicodeBuf, sizeof(unicodeBuf) / sizeof(TCHAR)); ListView_SetItemText(certificatesList, currentCertIndex, 2, unicodeBuf); free(validTo); MultiByteToWideChar(CP_UTF8, 0, EstEID_mapGet(cert, "certHash"), -1, unicodeBuf, sizeof(unicodeBuf) / sizeof(TCHAR)); ListView_SetItemText(certificatesList, currentCertIndex, 3, unicodeBuf); currentCertIndex++; } }
INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { struct IcoLibOptsData *dat; static HTREEITEM prevItem = 0; static HWND hPreview = NULL; dat = (struct IcoLibOptsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); hPreview = GetDlgItem(hwndDlg, IDC_PREVIEW); dat = (struct IcoLibOptsData*)mir_alloc(sizeof(struct IcoLibOptsData)); dat->hwndIndex = NULL; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); // // Reset temporary data & upload sections list // { mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) { iconList[indx]->temp_file = NULL; iconList[indx]->temp_icon = NULL; iconList[indx]->temp_reset = FALSE; } bNeedRebuild = FALSE; } // // Setup preview listview // ListView_SetUnicodeFormat(hPreview, TRUE); ListView_SetExtendedListViewStyleEx(hPreview, LVS_EX_INFOTIP, LVS_EX_INFOTIP); ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 0, 30), LVSIL_NORMAL); ListView_SetIconSpacing(hPreview, 56, 67); SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0); return TRUE; case DM_REBUILD_CTREE: { HWND hwndTree = GetDlgItem(hwndDlg, IDC_CATEGORYLIST); int indx; TCHAR itemName[1024]; HTREEITEM hSection; if (!hwndTree) break; TreeView_SelectItem(hwndTree, NULL); TreeView_DeleteAllItems(hwndTree); for (indx = 0; indx < sectionList.getCount(); indx++) { TCHAR* sectionName; int sectionLevel = 0; hSection = NULL; mir_tstrcpy(itemName, sectionList[indx]->name); sectionName = itemName; while (sectionName) { // allow multi-level tree TCHAR* pItemName = sectionName; HTREEITEM hItem; if (sectionName = _tcschr(sectionName, '/')) { // one level deeper *sectionName = 0; } pItemName = TranslateTS(pItemName); hItem = FindNamedTreeItemAt(hwndTree, hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { TVINSERTSTRUCT tvis = {0}; TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem)); treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE); treeItem->paramName = mir_t2a(itemName); tvis.hParent = hSection; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; tvis.item.pszText = pItemName; tvis.item.lParam = (LPARAM) treeItem; tvis.item.state = tvis.item.stateMask = db_get_b(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED); hItem = TreeView_InsertItem(hwndTree, &tvis); } else { TVITEM tvi = {0}; tvi.hItem = hItem; tvi.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(hwndTree, &tvi); TreeItem *treeItem = (TreeItem *)tvi.lParam; treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, SECTIONPARAM_HAVEPAGE); } } if (sectionName) { *sectionName = '/'; sectionName++; } sectionLevel++; hSection = hItem; } } ShowWindow(hwndTree, SW_SHOW); TreeView_SelectItem(hwndTree, FindNamedTreeItemAt(hwndTree, 0, NULL)); } break; // Rebuild preview to new section case DM_REBUILDICONSPREVIEW: { SectionItem* sectionActive = (SectionItem*)lParam; EnableWindow(hPreview, sectionActive != NULL); ListView_DeleteAllItems(hPreview); HIMAGELIST hIml = ListView_GetImageList(hPreview, LVSIL_NORMAL); ImageList_RemoveAll(hIml); if (sectionActive == NULL) break; LVITEM lvi = {0}; lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; { mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) { IcolibItem *item = iconList[indx]; if (item->section == sectionActive) { lvi.pszText = item->getDescr(); HICON hIcon = item->temp_icon; if (!hIcon) hIcon = IconItem_GetIcon_Preview(item); lvi.iImage = ImageList_AddIcon(hIml, hIcon); lvi.lParam = indx; ListView_InsertItem(hPreview, &lvi); if (hIcon != item->temp_icon) SafeDestroyIcon(&hIcon); } } } if (sectionActive->flags & SIDF_SORTED) ListView_SortItems(hPreview, DoSortIconsFunc, 0); else ListView_SortItems(hPreview, DoSortIconsFuncByOrder, 0); } break; // Refresh preview to new section case DM_UPDATEICONSPREVIEW: { LVITEM lvi = {0}; HICON hIcon; int indx, count; HIMAGELIST hIml = ListView_GetImageList(hPreview, LVSIL_NORMAL); lvi.mask = LVIF_IMAGE|LVIF_PARAM; count = ListView_GetItemCount(hPreview); for (indx = 0; indx < count; indx++) { lvi.iItem = indx; ListView_GetItem(hPreview, &lvi); { mir_cslock lck(csIconList); hIcon = iconList[lvi.lParam]->temp_icon; if (!hIcon) hIcon = IconItem_GetIcon_Preview(iconList[lvi.lParam]); } if (hIcon) ImageList_ReplaceIcon(hIml, lvi.iImage, hIcon); if (hIcon != iconList[lvi.lParam]->temp_icon) SafeDestroyIcon(&hIcon); } ListView_RedrawItems(hPreview, 0, count); } break; // Temporary change icon - only inside options dialog case DM_CHANGEICON: { LVITEM lvi = {0}; lvi.mask = LVIF_PARAM; lvi.iItem = wParam; ListView_GetItem(hPreview, &lvi); { mir_cslock lck(csIconList); IcolibItem *item = iconList[ lvi.lParam ]; SAFE_FREE((void**)&item->temp_file); SafeDestroyIcon(&item->temp_icon); TCHAR *path = (TCHAR*)lParam; item->temp_file = mir_tstrdup(path); item->temp_icon = (HICON)ExtractIconFromPath(path, item->cx, item->cy); item->temp_reset = FALSE; } DoOptionsChanged(hwndDlg); } break; case WM_COMMAND: if (LOWORD(wParam) == IDC_IMPORT) { dat->hwndIndex = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICOLIB_IMPORT), GetParent(hwndDlg), DlgProcIconImport, (LPARAM)hwndDlg); EnableWindow((HWND)lParam, FALSE); } else if (LOWORD(wParam) == IDC_GETMORE) { OpenIconsPage(); break; } else if (LOWORD(wParam) == IDC_LOADICONS) { TCHAR filetmp[1] = {0}; TCHAR *file; if (file = OpenFileDlg(hwndDlg, filetmp, FALSE)) { HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST); TCHAR filename[ MAX_PATH ]; PathToRelativeT(file, filename); SAFE_FREE((void**)&file); MySetCursor(IDC_WAIT); LoadSubIcons(htv, filename, TreeView_GetSelection(htv)); MySetCursor(IDC_ARROW); DoOptionsChanged(hwndDlg); } } break; case WM_CONTEXTMENU: if ((HWND)wParam == hPreview) { UINT count = ListView_GetSelectedCount(hPreview); if (count > 0) { int cmd = OpenPopupMenu(hwndDlg); switch(cmd) { case ID_CANCELCHANGE: case ID_RESET: { LVITEM lvi = {0}; int itemIndx = -1; while ((itemIndx = ListView_GetNextItem(hPreview, itemIndx, LVNI_SELECTED)) != -1) { lvi.mask = LVIF_PARAM; lvi.iItem = itemIndx; //lvhti.iItem; ListView_GetItem(hPreview, &lvi); UndoChanges(lvi.lParam, cmd); } DoOptionsChanged(hwndDlg); break; } } } } else { HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST); if ((HWND)wParam == htv) { int cmd = OpenPopupMenu(hwndDlg); switch(cmd) { case ID_CANCELCHANGE: case ID_RESET: UndoSubItemChanges(htv, TreeView_GetSelection(htv), cmd); DoOptionsChanged(hwndDlg); break; } } } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch(((LPNMHDR)lParam)->code) { case PSN_APPLY: { mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) { IcolibItem *item = iconList[indx]; if (item->temp_reset) { db_unset(NULL, "SkinIcons", item->name); if (item->source_small != item->default_icon) { IconSourceItem_Release(&item->source_small); } } else if (item->temp_file) { db_set_ts(NULL, "SkinIcons", item->name, item->temp_file); IconSourceItem_Release(&item->source_small); SafeDestroyIcon(&item->temp_icon); } } } DoIconsChanged(hwndDlg); return TRUE; } break; case IDC_PREVIEW: if (((LPNMHDR)lParam)->code == LVN_GETINFOTIP) { IcolibItem *item; NMLVGETINFOTIP *pInfoTip = (NMLVGETINFOTIP *)lParam; LVITEM lvi; lvi.mask = LVIF_PARAM; lvi.iItem = pInfoTip->iItem; ListView_GetItem(pInfoTip->hdr.hwndFrom, &lvi); if (lvi.lParam < iconList.getCount()) { item = iconList[lvi.lParam]; if (item->temp_file) _tcsncpy(pInfoTip->pszText, item->temp_file, pInfoTip->cchTextMax); else if (item->default_file) mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx); } } if (bNeedRebuild) { bNeedRebuild = FALSE; SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0); } break; case IDC_CATEGORYLIST: switch(((NMHDR*)lParam)->code) { case TVN_SELCHANGEDA: // !!!! This needs to be here - both !! case TVN_SELCHANGEDW: { NMTREEVIEW *pnmtv = (NMTREEVIEW*)lParam; TVITEM tvi = pnmtv->itemNew; TreeItem *treeItem = (TreeItem *)tvi.lParam; if (treeItem) SendMessage(hwndDlg, DM_REBUILDICONSPREVIEW, 0, (LPARAM)( (SECTIONPARAM_FLAGS(treeItem->value)&SECTIONPARAM_HAVEPAGE)? sectionList[ SECTIONPARAM_INDEX(treeItem->value) ] : NULL)); break; } case TVN_DELETEITEMA: // no idea why both TVN_SELCHANGEDA/W should be there but let's keep this both too... case TVN_DELETEITEMW: { TreeItem *treeItem = (TreeItem *)(((LPNMTREEVIEW)lParam)->itemOld.lParam); if (treeItem) { mir_free(treeItem->paramName); mir_free(treeItem); } break; } } if (bNeedRebuild) { { mir_cslock lck(csIconList); bNeedRebuild = FALSE; } SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0); } } break; case WM_DESTROY: SaveCollapseState( GetDlgItem(hwndDlg, IDC_CATEGORYLIST)); DestroyWindow(dat->hwndIndex); { mir_cslock lck(csIconList); for (int indx = 0; indx < iconList.getCount(); indx++) { IcolibItem *item = iconList[indx]; SAFE_FREE((void**)&item->temp_file); SafeDestroyIcon(&item->temp_icon); } } SAFE_FREE((void**)&dat); break; } return FALSE; }
BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { RECT wrect; switch(uMsg) { case WM_INITDIALOG: { if (MetaPosX==-32000) MetaPosX=0; //Just in case if (MetaPosY==-32000) MetaPosY=0; SetWindowPos(hwndDlg,0,MetaPosX,MetaPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); //setup columns HWND hwndList = GetDlgItem(hwndDlg,IDC_LIST1); ListView_SetExtendedListViewStyleEx(hwndList, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES , LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES ); ListView_SetUnicodeFormat(hwndList,TRUE); RECT listRect; GetClientRect(hwndList,&listRect); LVCOLUMN lvc; int colidx=0; lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.pszText = "Key"; lvc.cx = 100; ListView_InsertColumn(hwndList, colidx++, &lvc); lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.pszText = "Value"; lvc.cx = listRect.right - 100; ListView_InsertColumn(hwndList, colidx++, &lvc); //Display the Subtitles into the Metadata as well for(uint32 i=0;i<currSubtitles.size();i++) { std::string& subtitle = currSubtitles[i]; size_t splitat = subtitle.find_first_of(' '); std::wstring key, value; //if we can't split it then call it an unnamed key if(splitat == std::string::npos) { value = mbstowcs(subtitle); } else { key = mbstowcs(subtitle.substr(0,splitat)); value = mbstowcs(subtitle.substr(splitat+1)); } LVITEM lvi; lvi.iItem = i; lvi.mask = LVIF_TEXT; lvi.iSubItem = 0; lvi.pszText = (LPSTR)key.c_str(); SendMessageW(hwndList, LVM_INSERTITEMW, 0, (LPARAM)&lvi); lvi.iSubItem = 1; lvi.pszText = (LPSTR)value.c_str(); SendMessageW(hwndList, LVM_SETITEMTEXTW, i, (LPARAM)&lvi); } //Display Subtitle Heading if (currSubtitles.size() > 0) //If no subtitles, don't bother with this heading { std::wstring rHeading = mbstowcs(string("SUBTITLES")); LVITEM lvSubtitle; lvSubtitle.iItem = 0; lvSubtitle.mask = LVIF_TEXT; lvSubtitle.iSubItem = 0; lvSubtitle.pszText = (LPSTR)rHeading.c_str(); SendMessageW(hwndList, LVM_INSERTITEMW, 0, (LPARAM)&lvSubtitle); } //Display the comments in the movie data for(uint32 i=0;i<currComments.size();i++) { std::wstring& comment = currComments[i]; size_t splitat = comment.find_first_of(' '); std::wstring key, value; //if we can't split it then call it an unnamed key if(splitat == std::string::npos) { value = comment; } else { key = comment.substr(0,splitat); value = comment.substr(splitat+1); } LVITEM lvi; lvi.iItem = i; lvi.mask = LVIF_TEXT; lvi.iSubItem = 0; lvi.pszText = (LPSTR)key.c_str(); SendMessageW(hwndList, LVM_INSERTITEMW, 0, (LPARAM)&lvi); lvi.iSubItem = 1; lvi.pszText = (LPSTR)value.c_str(); SendMessageW(hwndList, LVM_SETITEMTEXTW, i, (LPARAM)&lvi); } } break; case WM_MOVE: if (!IsIconic(hwndDlg)) { GetWindowRect(hwndDlg,&wrect); MetaPosX = wrect.left; MetaPosY = wrect.top; #ifdef WIN32 WindowBoundsCheckNoResize(MetaPosX,MetaPosY,wrect.right); #endif } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; } break; } return FALSE; }