// --- BOOL CSelectInterfacesDlg::OnInitDialog() { BOOL bResult = CDialog::OnInitDialog(); int nFirstItemLevel = 1; CCTItemsArray &newItems = *new CCTItemsArray( true ); if(!m_nRegime) LoadPluginStuff(m_hImpData, newItems, nFirstItemLevel); HDATA hCurrData = ::DATA_Get_First( m_hImpData, NULL ); while ( hCurrData ) { if(!IsPluginStaticInterfaceRoot(hCurrData)) LoadOneInterfaceStuff( hCurrData, newItems, nFirstItemLevel ); hCurrData = ::DATA_Get_Next( hCurrData, NULL ); } m_idSelectedIFace = -1; m_CTTControl.SetItemsArray( &newItems ); m_RegStorage.GetValue( g_RegValueNameTable[m_nRegime][0], (DWORD &)m_bNewSession ); DWORD dwStyle = ListView_GetExtendedListViewStyle( m_Objects ); dwStyle |= LVS_EX_FULLROWSELECT;// | LVS_EX_GRIDLINES; ListView_SetExtendedListViewStyle( m_Objects, dwStyle ); // set generators list header CCLColumnsArray *pColumnsArray = new CCLColumnsArray( true ); for ( int i=0; i<g_nObjectsHeaderIDTableCount; i++ ) { CCheckListColumn *pColumn = new CCheckListColumn(); CString rString; rString.LoadString( g_nObjectsHeaderIDTable[i] ); pColumn->SetName( rString ); pColumn->SetAlignment( CCheckListColumn::ca_Left ); pColumnsArray->Add( pColumn ); } m_Objects.SetColumnsArray( pColumnsArray ); FillGeneratorsList(); if ( m_bNewSession ) { CheckDlgButton( IDC_CGOF_NEWSESSION_RBTN, BST_CHECKED ); OnNewSession(); } else { CheckDlgButton( IDC_CGOF_USEFILE_RBTN, BST_CHECKED ); OnUseFile(); } if(IsProtoMode()) { GetDlgItem(IDC_CGOF_INCLUDEDIR)->EnableWindow(FALSE); GetDlgItem(IDC_CGOF_INCLUDEBROWSE)->EnableWindow(FALSE); } return bResult; }
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 TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem, int index2set) { Window::init(hInst, parent); _currentIndex = index2set; INITCOMMONCONTROLSEX icex; // Ensure that the common control DLL is loaded. icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); _nbItem = nbItem; // Create the list-view window in report view with label editing enabled. int listViewStyles = LVS_REPORT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER\ | LVS_NOSCROLL | LVS_SINGLESEL | LVS_AUTOARRANGE | LVS_OWNERDRAWFIXED\ | LVS_SHAREIMAGELISTS/* | WS_BORDER*/; _hSelf = ::CreateWindow(WC_LISTVIEW, "", WS_CHILD | listViewStyles, 0, 0, 0, 0, _hParent, (HMENU) NULL, hInst, NULL); if (!_hSelf) { systemMessage("System Err"); throw int(69); } ::SetWindowLong(_hSelf, GWL_USERDATA, reinterpret_cast<LONG>(this)); _defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLong(_hSelf, GWL_WNDPROC, reinterpret_cast<LONG>(staticProc))); DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf); exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ; ListView_SetExtendedListViewStyle(_hSelf, exStyle); LVCOLUMN lvColumn; lvColumn.mask = LVCF_WIDTH; lvColumn.cx = 1500; ListView_InsertColumn(_hSelf, 0, &lvColumn); ListView_SetItemCountEx(_hSelf, _nbItem, LVSICF_NOSCROLL); ListView_SetImageList(_hSelf, hImaLst, LVSIL_SMALL); ListView_SetItemState(_hSelf, _currentIndex, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); ListView_SetBkColor(_hSelf, veryLiteGrey); ListView_SetTextBkColor(_hSelf, veryLiteGrey); }
void ListView::init(HINSTANCE hInst, HWND parent) { Window::init(hInst, parent); INITCOMMONCONTROLSEX icex; // Ensure that the common control DLL is loaded. icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); // Create the list-view window in report view with label editing enabled. int listViewStyles = LVS_REPORT | LVS_NOSORTHEADER\ | LVS_SINGLESEL | LVS_AUTOARRANGE\ | LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS; _hSelf = ::CreateWindow(WC_LISTVIEW, TEXT(""), WS_CHILD | listViewStyles, 0, 0, 0, 0, _hParent, (HMENU) NULL, hInst, NULL); if (!_hSelf) { throw std::runtime_error("ListView::init : CreateWindowEx() function return null"); } ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); _defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticProc)); DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf); exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ; ListView_SetExtendedListViewStyle(_hSelf, exStyle); LVCOLUMN lvColumn; lvColumn.mask = LVCF_TEXT|LVCF_WIDTH; NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal"); generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex"); generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar"); lvColumn.cx = 45; lvColumn.pszText = (TCHAR *)valStr.c_str(); ListView_InsertColumn(_hSelf, 0, &lvColumn); lvColumn.cx = 45; lvColumn.pszText = (TCHAR *)hexStr.c_str(); ListView_InsertColumn(_hSelf, 1, &lvColumn); lvColumn.cx = 70; lvColumn.pszText = (TCHAR *)charStr.c_str(); ListView_InsertColumn(_hSelf, 2, &lvColumn); }
void TableViewImpl::setExtendedStyleFlag(long flag, bool value) { auto style = ListView_GetExtendedListViewStyle(hWnd); if( value ) { style |= flag; } else { style &= ~flag; } ListView_SetExtendedListViewStyle(hWnd,style); }
TableViewImpl * TableViewImpl::clone() const { auto result = std::make_unique<TableViewImpl>(getParentHandle(),getControlData()); ListView_SetExtendedListViewStyle(result->hWnd,ListView_GetExtendedListViewStyle(hWnd)); result->imageListImpl = imageListImpl; for( int c = 0; c != colCount; ++c ) { result->addColumn(column(c)); } result->setRows(rowCount); return result.release(); }
SensorListControl::SensorListControl(HWND hWnd) : CustomDrawListControl(hWnd, Columns) { EnsureImageLoaded(SensorPicture, IDB_KINECTSENSORPICTURE); EnsureFontCreated(StatusLargeFont, 25, FW_MEDIUM); ListView_SetExtendedListViewStyle(m_hWnd, ListView_GetExtendedListViewStyle(m_hWnd) | LVS_EX_SUBITEMIMAGES); HIMAGELIST hImgList = ImageList_Create(SensorListImageWidth, SensorListRowHeight, ILC_COLORDDB, 1, 1); ListView_SetImageList(m_hWnd, hImgList, LVSIL_SMALL); }
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(); }
INT_PTR CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { static char *keyid; HWND hLV = GetDlgItem(hdlg,IDC_KEYLIST); switch(msg) { case WM_INITDIALOG: { int i; LVCOLUMN lvc; static char *szColHdr[] = { "Key ID", "User ID" }; static int iColWidth[] = { 110, 255 }; keyid = (char *)lparam; ZeroMemory(&lvc,sizeof(LVCOLUMN)); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; for (i = 0; i < 2; i++) { lvc.iSubItem = i; lvc.pszText = szColHdr[i]; lvc.cx = iColWidth[i]; ListView_InsertColumn(hLV, i, &lvc); } RefreshListView(hLV); ListView_SetExtendedListViewStyle(hLV, ListView_GetExtendedListViewStyle(hLV) | LVS_EX_FULLROWSELECT); ListView_SetItemState(hLV, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); EnableWindow(hLV, TRUE); } break; case WM_COMMAND: switch(LOWORD(wparam)) { case IDOK: ListView_GetItemText(hLV, ListView_GetNextItem(hLV, -1, LVNI_SELECTED), 0, keyid, keyidsize); case IDCANCEL: EndDialog(hdlg, wparam); return TRUE; break; case IDC_REFRESH: updateKeyUserIDs(publickeyuserid); updateKeyUserIDs(secretkeyuserid); RefreshListView(hLV); break; } break; } return FALSE; }
void TkeysPage::init(void) { keyChanging = -1; ignoreNextKey = false; hlv = GetDlgItem(m_hwnd, IDC_LV_KEYS); int ncol = 0; ListView_AddCol(hlv, ncol, cfgGet(IDFF_lvKeysWidth0), _l("Action"), false); ListView_AddCol(hlv, ncol, cfgGet(IDFF_lvKeysWidth1), _l("Key"), false); ListView_SetExtendedListViewStyle(hlv, ListView_GetExtendedListViewStyle(hlv) | LVS_EX_FULLROWSELECT); ListView_SetItemCount(hlv, deciD->getKeyParamCount2()); }
void TconvolverPage::init(void) { tbrSetRange(IDC_TBR_CONVOLVER_MIXINGSTRENGTH,0,100); tbrSetRange(IDC_TBR_CONVOLVER_LEVELADJUSTDB,-300,300); hlv=GetDlgItem(m_hwnd,IDC_LV_CONVOLVER_FILES); int ncol=0; ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth0),_(IDC_LV_CONVOLVER_FILES,_l("Channel")),false); ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth1),_(IDC_LV_CONVOLVER_FILES,_l("File")),false); ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth2),_(IDC_LV_CONVOLVER_FILES,_l("Format")),false); ListView_SetExtendedListViewStyle(hlv,ListView_GetExtendedListViewStyle(hlv)|LVS_EX_FULLROWSELECT); ListView_SetItemCount(hlv,6); lvSetSelItem(IDC_LV_CONVOLVER_FILES,cfgGet(IDFF_lvConvolverSelected)); }
void CEffectDlg::PresetOnInitDialog(HWND hwndDlg) { TCHAR szPath[MAX_PATH]; TCHAR sz[MAX_PATH]; WIN32_FIND_DATA wfd; HWND hwndLV = GetDlgItem(hwndDlg, IDC_LIST_PRESET); 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); SendMessage(hwndLV, WM_SETFONT, SendMessage(hwndDlg, WM_GETFONT, 0, 0), 0); if (!GetPresetDir(szPath)) return; if (_tcslen(szPath) + _tcslen(EFFECT_FILE_EXT) + 4 > MAX_PATH) return; wsprintf(sz, _T("%s\\*.%s"), szPath, EFFECT_FILE_EXT); HANDLE hFind = FindFirstFile(sz, &wfd); if (hFind != INVALID_HANDLE_VALUE) { do { LPTSTR p = _tcsrchr(wfd.cFileName, _T('.')); if (p) *p = NULL; LVITEM li; memset(&li, 0, sizeof(LVITEM)); li.mask = LVIF_TEXT; li.iItem = ListView_GetItemCount(hwndLV); li.pszText = wfd.cFileName; ListView_InsertItem(hwndLV, &li); } while (FindNextFile(hFind, &wfd)); FindClose(hFind); } EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), FALSE); }
void ShortcutMapper::initList() { int i; LV_COLUMN col={0}; TCHAR *col_names[3]={L"Index",L"Name",L"Shortcut"}; hlistview=GetDlgItem(_hSelf,IDC_SHORTCUT_LIST); for(i=0;i<sizeof(col_names)/sizeof(TCHAR *);i++){ col.mask=LVCF_FMT|LVCF_TEXT|LVCF_WIDTH; col.fmt=LVCFMT_LEFT; col.cx=gettextwidth(hlistview,col_names[i]); col.pszText=col_names[i]; ListView_InsertColumn(hlistview,i,&col); } ListView_SetExtendedListViewStyle(hlistview, ListView_GetExtendedListViewStyle(hlistview)|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); }
bool VDUIListViewW32::Create(IVDUIParameters *pParameters) { mbCheckable = pParameters->GetB(nsVDUI::kUIParam_Checkable, false); DWORD dwFlags = LVS_REPORT | WS_TABSTOP; if (pParameters->GetB(nsVDUI::kUIParam_NoHeader, false)) dwFlags |= LVS_NOCOLUMNHEADER; if (!CreateW32(pParameters, WC_LISTVIEW, dwFlags)) return false; ListView_SetExtendedListViewStyle(mhwnd, LVS_EX_FULLROWSELECT | ListView_GetExtendedListViewStyle(mhwnd)); if (mbCheckable) { const int cx = GetSystemMetrics(SM_CXMENUCHECK); const int cy = GetSystemMetrics(SM_CYMENUCHECK); if (HBITMAP hbm = CreateBitmap(cx, cy, 1, 1, NULL)) { if (HDC hdc = CreateCompatibleDC(NULL)) { if (HGDIOBJ hbmOld = SelectObject(hdc, hbm)) { bool success = false; RECT r = { 0, 0, cx, cy }; SetBkColor(hdc, PALETTEINDEX(0)); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &r, "", 0, NULL); DrawFrameControl(hdc, &r, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_CHECKED); SelectObject(hdc, hbmOld); if (HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR, 1, 1)) { if (ImageList_Add(himl, hbm, NULL) >= 0) ListView_SetImageList(mhwnd, himl, LVSIL_STATE); else ImageList_Destroy(himl); } } DeleteDC(hdc); } DeleteObject(hbm); } } return true; }
void NListView::ListView_ActivateOneClickSelect(HWND hListView,BOOL bActivate,UINT uHoverTime) { DWORD dwExtendedStyle = ListView_GetExtendedListViewStyle(hListView); /* The three styles below are used to control one-click selection. */ if(bActivate) { if((dwExtendedStyle & LVS_EX_TRACKSELECT) != LVS_EX_TRACKSELECT) { dwExtendedStyle |= LVS_EX_TRACKSELECT; } if((dwExtendedStyle & LVS_EX_ONECLICKACTIVATE) != LVS_EX_ONECLICKACTIVATE) { dwExtendedStyle |= LVS_EX_ONECLICKACTIVATE; } if((dwExtendedStyle & LVS_EX_UNDERLINEHOT) != LVS_EX_UNDERLINEHOT) { dwExtendedStyle |= LVS_EX_UNDERLINEHOT; } ListView_SetExtendedListViewStyle(hListView,dwExtendedStyle); ListView_SetHoverTime(hListView,uHoverTime); } else { if((dwExtendedStyle & LVS_EX_TRACKSELECT) == LVS_EX_TRACKSELECT) { dwExtendedStyle &= ~LVS_EX_TRACKSELECT; } if((dwExtendedStyle & LVS_EX_ONECLICKACTIVATE) == LVS_EX_ONECLICKACTIVATE) { dwExtendedStyle &= ~LVS_EX_ONECLICKACTIVATE; } if((dwExtendedStyle & LVS_EX_UNDERLINEHOT) == LVS_EX_UNDERLINEHOT) { dwExtendedStyle &= ~LVS_EX_UNDERLINEHOT; } ListView_SetExtendedListViewStyle(hListView,dwExtendedStyle); } }
BOOL CJmcHotkeyPage::OnInitDialog() { CPropertyPage::OnInitDialog(); //vls-begin// grouped hotkeys AddPage("hotkey", this); m_ImageList.Create(IDB_GROUP_ICONS, 16 , 2, (COLORREF)0xFFFFFF); //vls-end// DWORD Exstyle = ListView_GetExtendedListViewStyle(m_cHotkeysList.GetSafeHwnd()); Exstyle += LVS_EX_FULLROWSELECT; ListView_SetExtendedListViewStyleEx(m_cHotkeysList.GetSafeHwnd () , 0 , Exstyle); CString t; t.LoadString(IDS_KP_KEY_COL); m_cHotkeysList.InsertColumn (0 , t , LVCFMT_LEFT , 100 ); t.LoadString(IDS_AP_TEXT_COL); m_cHotkeysList.InsertColumn (1 , t , LVCFMT_LEFT , 200 ); //vls-begin// grouped hotkeys t.LoadString(IDS_AP_GROUP_COL); m_cHotkeysList.InsertColumn (2 , t , LVCFMT_LEFT , 100 ); m_cHotkeysList.SetImageList(&m_ImageList, LVSIL_SMALL); //vls-end// // fill list int size; PPCHotKey ppHot = GetHotList(&size); for ( int i = 0 ; i < size ; i++ ) { AddItem(ppHot[i]); } m_cHotkeysList.SortItems(HkeyCompareFunc, 0); m_wndHotCtrl.SubclassDlgItem(IDC_KEY, this); //vls-begin// grouped hotkeys // init group list m_cGroupList.Reinit(); m_cGroup.Reinit (FALSE); ResetList(); //vls-end// SetControls(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
SONGLIST* SongListInit(const RECT* rect, const MAINWND* main_wnd) { songlist.scan = FALSE; songlist.rect.left = 0; songlist.rect.top = rect->top; songlist.rect.right = rect->right; songlist.rect.bottom = rect->bottom; LONG x = songlist.rect.left; LONG y = songlist.rect.top; LONG w = songlist.rect.right - songlist.rect.left - 6; LONG h = songlist.rect.bottom - songlist.rect.top; songlist.hWnd = CreateWindow(WC_LISTVIEW, NULL, WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_OWNERDRAWFIXED, x, y, w, h, main_wnd->hWnd, (HMENU)IDC_SONGLIST, main_wnd->inst, NULL); if (songlist.hWnd == NULL) return FALSE; DWORD style = ListView_GetExtendedListViewStyle(songlist.hWnd); style |= LVS_EX_FULLROWSELECT; ListView_SetExtendedListViewStyle(songlist.hWnd, style); songlist.rect.left = 0; songlist.rect.top = 0; songlist.rect.right = w; songlist.rect.bottom = h; songlist.mdc = GetDC(songlist.hWnd); songlist.bdc = CreateCompatibleDC(songlist.mdc); songlist.bitmap = CreateCompatibleBitmap(songlist.mdc, w, h); SelectObject(songlist.bdc, songlist.bitmap); if (!LoadImage(main_wnd->inst, IDB_PNG_PLAY, L"PNG", &songlist.imgplay, &songlist.mdc)) return FALSE; if (!LoadImage(main_wnd->inst, IDB_PNG_PAUSE, L"PNG", &songlist.imgpause, &songlist.mdc)) return FALSE; SongListColumn(); ListView_SetBkColor(songlist.hWnd, RGB(0, 0, 0)); songlist.quit = FALSE; songlist.exit = CreateEvent(NULL, FALSE, FALSE, NULL); songlist.thread = CreateThread(NULL, 0, SongListThread, &songlist, 0, &songlist.thread_id); return &songlist; }
/* OnCreate() */ VIRTUAL int CListViewEx::OnCreate(LPCREATESTRUCT lpcs) { // classe base if(CListView::OnCreate(lpcs)==-1) return(-1); // tooltip m_ToolTipCtrl.Create(this); m_ToolTipCtrl.SetMaxTipWidth(MAX_TOOLTIP_TEXT); // stili estesi: seleziona l'intera riga DWORD dwStyle = ListView_GetExtendedListViewStyle(this->m_hWnd); if(!(dwStyle & LVS_EX_FULLROWSELECT)) { dwStyle |= LVS_EX_FULLROWSELECT; ListView_SetExtendedListViewStyle(this->m_hWnd,dwStyle); } return(0); }
void NListView::ListView_AddRemoveExtendedStyle(HWND hListView,DWORD dwStyle,BOOL bAdd) { DWORD dwExtendedStyle = ListView_GetExtendedListViewStyle(hListView); if(bAdd) { if((dwExtendedStyle & dwStyle) != dwStyle) { dwExtendedStyle |= dwStyle; } } else { if((dwExtendedStyle & dwStyle) == dwStyle) { dwExtendedStyle &= ~dwStyle; } } ListView_SetExtendedListViewStyle(hListView,dwExtendedStyle); }
void NListView::ListView_SetGridlines(HWND hListView,BOOL bEnableGridlines) { DWORD dwExtendedStyle = ListView_GetExtendedListViewStyle(hListView); if(bEnableGridlines) { if((dwExtendedStyle & LVS_EX_GRIDLINES) != LVS_EX_GRIDLINES) { dwExtendedStyle |= LVS_EX_GRIDLINES; } } else { if((dwExtendedStyle & LVS_EX_GRIDLINES) == LVS_EX_GRIDLINES) { dwExtendedStyle &= ~LVS_EX_GRIDLINES; } } ListView_SetExtendedListViewStyle(hListView,dwExtendedStyle); }
void CPpcMainWnd::CreateListView() { DWORD dwStyle = WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_NOCOLUMNHEADER; m_hwndLV = CreateWindow(WC_LISTVIEW, NULL, dwStyle, PPC_PLAYLIST_LEFT, PPC_PLAYLIST_TOP, PPC_PLAYLIST_WIDTH, PPC_PLAYLIST_HEIGHT, m_hWnd, 0, GetInst(), NULL); ListView_SetExtendedListViewStyle(m_hwndLV, ListView_GetExtendedListViewStyle(m_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(m_hwndLV, 0, &lvc); RECT rc; GetWindowRect(m_hwndLV, &rc); SendMessage(m_hwndLV, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - GetSystemMetrics(SM_CXBORDER) * 2 - 1, 0)); }
void MappingDlg::Init(HINSTANCE hInst, HWND hWnd) { m_hWnd = hWnd; m_hDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAPPING), hWnd, (DLGPROC)MappingDlg::Proc, (LPARAM)this); m_hList = GetDlgItem(m_hDlg, IDC_MAPPING_LIST); DWORD dwStyle = ListView_GetExtendedListViewStyle(m_hList); dwStyle |= LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES; ListView_SetExtendedListViewStyle(m_hList, dwStyle); LVCOLUMN col; col.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; col.fmt = LVCFMT_LEFT; col.cx = 200; col.pszText = I18N.DS4Button; ListView_InsertColumn(m_hList, 0, &col); col.pszText = I18N.vJoyButton; col.cx = 200; ListView_InsertColumn(m_hList, 1, &col); m_hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU_MAPPING)); }
int KUiWndFrameTabControl::Init(HWND hWnd, RECT* pRc, const char *pszName) { int nResult = false; int nRetCode = false; KG_PROCESS_ERROR(hWnd); strcpy(m_szName, pszName); m_hWnd = ::CreateDialog((HINSTANCE)g_hPluginInstance, MAKEINTRESOURCE(IDD_WndFrameTabControl), hWnd, (DLGPROC)WndProc); KG_PROCESS_ERROR(m_hWnd); ::SetWindowPos(m_hWnd, HWND_TOP, pRc->left, pRc->top, pRc->right - pRc->left, pRc->bottom - pRc->top, SWP_SHOWWINDOW); ::SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)(KUiWndWindow*)this); m_hListWnd = ::GetDlgItem(m_hWnd, IDC_WND_FRAME_FOCUS_LIST); //设置文件列表框的属性与分栏信息 ListView_SetExtendedListViewStyle(m_hListWnd, ListView_GetExtendedListViewStyle(m_hListWnd) | LVS_EX_FULLROWSELECT); RECT rc; ::GetClientRect(m_hListWnd, &rc); LVCOLUMN lvc; char szHeaderText[128]; lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.cx = (rc.right - rc.left); lvc.pszText = szHeaderText; lvc.cchTextMax = 128; strcpy(szHeaderText, "焦点切换顺序(从上到下):"); ListView_InsertColumn(m_hListWnd, 0, &lvc); nResult = true; Exit0: return nResult; }
LRESULT CAttachHostDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { ::SetWindowText(GetDlgItem(IDC_HOST_ADDRESS), m_szAddress); m_StateList.m_hWnd = GetDlgItem(IDC_STATE_LIST); m_StateList.AddColumn(_T("SID"), 1); m_StateList.AddColumn(_T("Name"), 2); m_StateList.AddColumn(_T("Client"), 3); m_StateList.AddColumn(_T("CID"), 4); m_StateList.SetColumnWidth(0, 80); m_StateList.SetColumnWidth(1, 100); m_StateList.SetColumnWidth(2, 130); m_StateList.SetColumnWidth(3, 80); ListView_SetExtendedListViewStyle(GetDlgItem(IDC_STATE_LIST), ListView_GetExtendedListViewStyle(GetDlgItem(IDC_STATE_LIST))|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); m_StateList.SetWindowLong(GWL_STYLE, m_StateList.GetStyle() | LVS_SINGLESEL); //m_StateList.AddItem(0, 0, "0xFFFFFFFF"); //m_StateList.AddItem(0, 1, "CLIENT FOR YOU"); //m_StateList.AddItem(0, 2, "255.255.255.255:65536"); //m_StateList.AddItem(0, 3, "0xFFFFFFFF"); return 0; }
BOOL CdllsDlg::OnInitDialog() { __super::OnInitDialog(); //AddAnchor(IDC_APP_ICON,TOP_LEFT); //AddAnchor(IDC_STATIC_VER,TOP_LEFT); //AddAnchor(IDC_STATIC_COPY,TOP_LEFT); //AddAnchor(IDB_SAVE,TOP_RIGHT); //AddAnchor(IDOK,TOP_RIGHT); AddAnchor(IDB_SAVE,TOP_LEFT); AddAnchor(IDCANCEL,TOP_RIGHT); AddAnchor(IDC_LVW,TOP_LEFT , BOTTOM_RIGHT); // TODO: Add extra initialization here HWND hwndListView =GetDlgItem(IDC_LVW)->m_hWnd; DWORD dwStyle = ListView_GetExtendedListViewStyle(hwndListView); dwStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP ; ListView_SetExtendedListViewStyle(hwndListView, dwStyle); LV_COLUMN lvColumn; lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 300; lvColumn.pszText = _T("Module name"); ListView_InsertColumn (hwndListView, 0, &lvColumn); lvColumn.pszText = _T("version"); RECT rc; ::GetWindowRect(hwndListView,&rc); lvColumn.cx = 200/*(rc.right-rc.left)-300-20*/; ListView_InsertColumn (hwndListView, 1, &lvColumn); HANDLE pProcessHandle = NULL; pProcessHandle = GetCurrentProcess(); HMODULE hInstLib = LoadLibrary( _T("PSAPI.DLL") ) ; if (pProcessHandle != NULL&&hInstLib!=NULL) { HMODULE pLoadedModules[4096]; DWORD nLoadedBytes = 0; // Get array of loaded modules BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *, DWORD, LPDWORD ); DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE, LPTSTR, DWORD ); lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD)) GetProcAddress( hInstLib, "EnumProcessModules" ) ; lpfGetModuleFileNameEx =(DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR, DWORD )) GetProcAddress( hInstLib, #ifdef _UNICODE "GetModuleFileNameExW" #else "GetModuleFileNameExA" #endif ) ; if (lpfEnumProcessModules(pProcessHandle, pLoadedModules, (DWORD)sizeof(pLoadedModules), &nLoadedBytes)) { // Compute effective number of modules int nNumberOfModules = nLoadedBytes/sizeof(HMODULE); // Loop on all modules for (int i=0; i<nNumberOfModules; i++) { // Fetch module file name TCHAR pFileName[_MAX_PATH]; pFileName[0]=0; CString cleanFileName; if (lpfGetModuleFileNameEx(pProcessHandle, pLoadedModules[i], pFileName, _MAX_PATH) > 0) { if(_tcslen(pFileName)>0&&_tcslen(pFileName)<ARRAY_SIZE(pFileName)) { CDLLVersion dll_ver(pFileName); LVITEM lvI; lvI.mask = LVIF_TEXT ; lvI.state = 0; lvI.stateMask = 0; lvI.iItem = i; lvI.iSubItem = 0; lvI.pszText = (pFileName); ListView_InsertItem(hwndListView, &lvI); LV_ITEM lv_sub; memset(&lv_sub,0,sizeof(LV_ITEM)); lv_sub.mask = LVIF_TEXT ; lv_sub.state = 0; lv_sub.stateMask = 0; lv_sub.iItem = i; lv_sub.iSubItem = 1; lv_sub.pszText = (LPTSTR)(LPCTSTR)dll_ver.GetFullVersion(); ListView_SetItem(hwndListView, &lv_sub); } } } } // Close process handle CloseHandle(pProcessHandle); } FreeLibrary(hInstLib); return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
DWORD ListView::getExStyle() { return ListView_GetExtendedListViewStyle(m_hwnd); }
INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT rc; int nXDifference; int nYDifference; int cx, cy; switch (message) { case WM_INITDIALOG: /* * Save the width and height */ GetClientRect(hDlg, &rc); nProcessPageWidth = rc.right; nProcessPageHeight = rc.bottom; /* Update window position */ SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); /* * Get handles to the controls */ hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST); hProcessPageHeaderCtrl = ListView_GetHeader(hProcessPageListCtrl); hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS); hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES); /* * Set the title, and extended window styles for the list control */ SetWindowTextW(hProcessPageListCtrl, L"Processes"); (void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP); AddColumns(); /* * Subclass the process list control so we can intercept WM_ERASEBKGND */ OldProcessListWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc); #ifdef RUN_PROC_PAGE /* Start our refresh thread */ hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, &dwProcessThread); #endif return TRUE; case WM_DESTROY: /* Close the event handle, this will make the */ /* refresh thread exit when the wait fails */ #ifdef RUN_PROC_PAGE EndLocalThread(&hProcessThread, dwProcessThread); #endif SaveColumnSettings(); break; case WM_COMMAND: /* Handle the button clicks */ switch (LOWORD(wParam)) { case IDC_ENDPROCESS: ProcessPage_OnEndProcess(); } break; case WM_SIZE: if (wParam == SIZE_MINIMIZED) return 0; cx = LOWORD(lParam); cy = HIWORD(lParam); nXDifference = cx - nProcessPageWidth; nYDifference = cy - nProcessPageHeight; nProcessPageWidth = cx; nProcessPageHeight = cy; /* Reposition the application page's controls */ GetWindowRect(hProcessPageListCtrl, &rc); cx = (rc.right - rc.left) + nXDifference; cy = (rc.bottom - rc.top) + nYDifference; SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER); InvalidateRect(hProcessPageListCtrl, NULL, TRUE); GetClientRect(hProcessPageEndProcessButton, &rc); MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT)); cx = rc.left + nXDifference; cy = rc.top + nYDifference; SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE); GetClientRect(hProcessPageShowAllProcessesButton, &rc); MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT)); cx = rc.left; cy = rc.top + nYDifference; SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER); InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE); break; case WM_NOTIFY: ProcessPageOnNotify(wParam, lParam); break; case WM_KEYDOWN: if (wParam == VK_DELETE) ProcessPage_OnEndProcess(); break; } return 0; }
static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { BOOL ret = SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); int sel = -1; for(int i = 0; i < languages.getCount(); i++) { Dictionary *p = languages[i]; SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)p->full_name); SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETITEMDATA, i, (LPARAM)new AutoreplaceData(p)); if ( !lstrcmp(opts.default_language, p->language)) sel = i; } SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_SETCURSEL, sel, 0); HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS); ListView_SetExtendedListViewStyle(hList, ListView_GetExtendedListViewStyle(hList) | LVS_EX_FULLROWSELECT); LVCOLUMN col = {0}; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ; col.fmt = LVCFMT_LEFT; col.cx = 175; col.pszText = TranslateT("Wrong word"); col.cchTextMax = lstrlen(col.pszText); ListView_InsertColumn(hList, 0, &col); col.pszText = TranslateT("Correction"); col.cchTextMax = lstrlen(col.pszText); ListView_InsertColumn(hList, 1, &col); LoadReplacements(hwndDlg); return ret; } case WM_COMMAND: if (LOWORD(wParam) == IDC_LANGUAGE && HIWORD(wParam) == CBN_SELCHANGE) LoadReplacements(hwndDlg); else if (LOWORD(wParam) == IDC_ADD) ShowAddReplacement(hwndDlg); else if (LOWORD(wParam) == IDC_EDIT) { HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS); if (ListView_GetSelectedCount(hList) != 1) break; int sel = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED); if (sel < 0) break; ShowAddReplacement(hwndDlg, sel); } else if (LOWORD(wParam) == IDC_REMOVE) { HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS); int sel = SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETCURSEL, 0, 0); if (sel < 0) break; AutoreplaceData *data = (AutoreplaceData *) SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETITEMDATA, sel, 0); BOOL changed = FALSE; sel = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED); while(sel >= 0) { TCHAR tmp[256]; ListView_GetItemText(hList, sel, 0, tmp, SIZEOF(tmp)); data->RemoveWord(tmp); changed = TRUE; sel = SendMessage(hList, LVM_GETNEXTITEM, sel, LVNI_SELECTED); } if (changed) { LoadReplacements(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; case WM_NOTIFY: { LPNMHDR lpnmhdr = (LPNMHDR)lParam; if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY && languages.getCount() > 0) { for(int i = 0; i < languages.getCount(); i++) { AutoreplaceData *data = (AutoreplaceData *) SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETITEMDATA, i, 0); if (data->changed) { data->dict->autoReplace->setMap(data->autoReplaceMap); data->changed = FALSE; } } } else if (lpnmhdr->idFrom == IDC_REPLACEMENTS) { HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS); switch(lpnmhdr->code) { case LVN_ITEMCHANGED: case NM_CLICK: EnableDisableCtrls(hwndDlg); break; case NM_DBLCLK: LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; if (lpnmitem->iItem >= 0) ShowAddReplacement(hwndDlg, lpnmitem->iItem); break; } } else if (lpnmhdr->idFrom == IDC_AUTO_USER) EnableDisableCtrls(hwndDlg); } break; case WM_DRAWITEM: { LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; if (lpdis->CtlID != IDC_LANGUAGE) break; if (lpdis->itemID == -1) break; AutoreplaceData *data = (AutoreplaceData *) lpdis->itemData; DrawItem(hwndDlg, lpdis, data->dict); } return TRUE; case WM_MEASUREITEM: LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam; if (lpmis->CtlID != IDC_LANGUAGE) break; MeasureItem(hwndDlg, lpmis); return TRUE; } return SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); }
int KUiFontManage::Init(HWND hWnd) { int nResult = false; int nRetCode = false; KG_PROCESS_ERROR(hWnd); KG_PROCESS_ERROR(m_szFontFileName[0]); m_hWnd = hWnd; RECT rcWindow; ::GetWindowRect(m_hWnd, &rcWindow); ::SetWindowPos(m_hWnd, HWND_TOP, 400, 200, rcWindow.right -rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_SHOWWINDOW); m_hListWnd = ::GetDlgItem(hWnd, IDC_WND_FONT_MANAGE_FONT_LIST); KG_PROCESS_ERROR(m_hListWnd); //设置文件列表框的属性与分栏信息 ListView_SetExtendedListViewStyle(m_hListWnd, ListView_GetExtendedListViewStyle(m_hListWnd) | LVS_EX_FULLROWSELECT); RECT rc; ::GetClientRect(m_hListWnd, &rc); LVCOLUMN lvc; char szHeaderText[128]; lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.cx = (rc.right - rc.left) / 3; lvc.pszText = szHeaderText; lvc.cchTextMax = 128; strcpy(szHeaderText, "字体名:"); ListView_InsertColumn(m_hListWnd, 0, &lvc); lvc.cx = (rc.right - rc.left) / 3; lvc.mask |= LVCF_SUBITEM; lvc.iSubItem = 1; strcpy(szHeaderText, "字体颜色"); ListView_InsertColumn(m_hListWnd, 1, &lvc); lvc.cx = (rc.right - rc.left) / 3; lvc.mask |= LVCF_SUBITEM; lvc.iSubItem = 1; strcpy(szHeaderText, "字边颜色"); ListView_InsertColumn(m_hListWnd, 2, &lvc); lvc.cx = (rc.right - rc.left) / 3; lvc.mask |= LVCF_SUBITEM; lvc.iSubItem = 1; strcpy(szHeaderText, "阴影颜色"); ListView_InsertColumn(m_hListWnd, 3, &lvc); //读入Font配置文件 if (m_pFontIni == NULL) { m_pFontIni = g_OpenIniFile(m_szFontFileName); } KG_PROCESS_ERROR(m_pFontIni); int nFontNum = 0; char szName[8] = ""; char szKey[32] = ""; int i = 0; nFontNum = m_pFontIni->GetSectionCount(); for (i = 0; i < nFontNum; i++) { sprintf(szName, "%d", i); m_pFontIni->GetString(szName, "Name", "", szKey, sizeof(szKey)); LV_ITEM lvi; memset(&lvi, 0, sizeof(LV_ITEM)); lvi.mask = LVIF_TEXT; lvi.pszText = (char*)szKey; lvi.cchTextMax = 128; lvi.iItem = ListView_GetItemCount(m_hListWnd); lvi.iItem = ListView_InsertItem(m_hListWnd, &lvi); m_pFontIni->GetString(szName, "Color", "", szKey, sizeof(szKey)); ListView_SetItemText(m_hListWnd, lvi.iItem, 1, szKey); m_pFontIni->GetString(szName, "BorderColor", "", szKey, sizeof(szKey)); ListView_SetItemText(m_hListWnd, lvi.iItem, 2, szKey); m_pFontIni->GetString(szName, "ProjectionColor", "", szKey, sizeof(szKey)); ListView_SetItemText(m_hListWnd, lvi.iItem, 3, szKey); } nResult = true; Exit0: return nResult; }