本文整理汇总了C++中ListView_SetItemText函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_SetItemText函数的具体用法?C++ ListView_SetItemText怎么用?C++ ListView_SetItemText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_SetItemText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertLogMsgParam
void InsertLogMsgParam(UINT nID, void *pParam, BYTE btFlags)
{
TCHAR szText[128];
TCHAR szMsg[256];
int nCount = AddNewLogMsg();
LoadString(g_hInst, nID, szText, sizeof(szText)/sizeof(TCHAR));
switch (btFlags)
{
case LOGPARAM_STR:
_stprintf(szMsg, szText, (LPTSTR)pParam);
break;
case LOGPARAM_INT:
_stprintf(szMsg, szText, *(int *)pParam);
break;
}
if (lstrlen(szMsg) <= 256)
{
ListView_SetItemText(g_hLogMsgWnd, nCount, 2, szMsg);
ListView_Scroll(g_hLogMsgWnd, 0, 8);
}
}
示例2: UpdateIPv6AddressField
void
UpdateIPv6AddressField(HWND hwndDlg, ULONG ulLabelId, TCHAR *szAddr)
{
HWND hListViewWnd = GetDlgItem(hwndDlg, IDC_IPV6_LISTBOX);
int iCount = 0;
DWORD dwID = 0;
LVITEM lvi = {0};
int i;
BOOL bFound = FALSE;
TCHAR szOldVal[INET6_ADDRSTRLEN];
if (!bListViewInit)
{
InitListView(hwndDlg);
}
// Locate the line that contains the info to be updated
for (i = 0; i < NUM_IPV6ITEMS; i++)
{
if (ulLabelId == ViewInfo[i].CtrlID)
{
// found the one we want to update
ListView_GetItemText(hListViewWnd, ViewInfo[i].RowID, 1, szOldVal, INET6_ADDRSTRLEN);
if (wcscmp(szOldVal, szAddr))
{
ListView_SetItemText(hListViewWnd, ViewInfo[i].RowID, 1, szAddr);
}
break;
}
}
}
示例3: UpdateGroupProperties
static VOID
UpdateGroupProperties(HWND hwndDlg)
{
TCHAR szGroupName[UNLEN];
INT iItem;
HWND hwndLV;
PLOCALGROUP_INFO_1 pGroupInfo = NULL;
hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
iItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
if (iItem == -1)
return;
/* Get the group name */
ListView_GetItemText(hwndLV,
iItem, 0,
szGroupName,
UNLEN);
NetLocalGroupGetInfo(NULL, szGroupName, 1, (LPBYTE*)&pGroupInfo);
ListView_SetItemText(hwndLV, iItem, 1,
pGroupInfo->lgrpi1_comment);
NetApiBufferFree(pGroupInfo);
}
示例4: AddNewLogMsg
int AddNewLogMsg()
{
LV_ITEM lvi;
TCHAR szText[64];
int nCount = ListView_GetItemCount(g_hLogMsgWnd);
if (nCount >= 100)
{
ListView_DeleteItem(g_hLogMsgWnd, 0);
nCount--;
}
lvi.mask = LVIF_TEXT;
lvi.iItem = nCount;
lvi.iSubItem = 0;
_tstrdate(szText);
lvi.pszText = szText;
ListView_InsertItem(g_hLogMsgWnd, &lvi);
_tstrtime(szText);
ListView_SetItemText(g_hLogMsgWnd, nCount, 1, szText);
return nCount;
}
示例5: ListView_GetItemCount
BOOL ZipDlg::ListAdd( Mp3File* pMp3, int intNum)
{
intNum = ( intNum < 0 ? ListView_GetItemCount( hwndList) : intNum) ;
vector< Mp3File*>::iterator p = vecFileList.begin() + intNum ;
// アイコン取得
SHFILEINFO shfi ;
SHGetFileInfo( pMp3->GetFilePath().c_str(), 0, &shfi, sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
// 表示文字列取得
string filename = pMp3->GetSaveName();
string fullpath = pMp3->GetFilePath();
// アイテム設定
LVITEM item = { LVIF_TEXT | LVIF_STATE | LVIF_PARAM | LVIF_IMAGE} ;
intNum = ( intNum < 0 ? ListView_GetItemCount( hwndList) : intNum) ;
item.iItem = intNum ;
item.state = LVIS_SELECTED ;
item.lParam = (LPARAM)pMp3 ;
item.pszText = (LPTSTR)filename.c_str() ;
item.iSubItem = 0 ;
item.iImage = shfi.iIcon ;
ListView_InsertItem( hwndList, &item) ;
ListView_SetItemText( hwndList, intNum, 1, (LPTSTR)fullpath.c_str()) ;
// リロード
ListReload() ;
return TRUE ;
}
示例6: InsertItem
//-----------------------------------------------------------------------------
void InsertItem(HWND _hwnd, char * _name, char * _value)
{
LVITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.pszText = "Should not be seen";
lvi.iItem = 1;
lvi.iSubItem = 0;
lvi.lParam = (LPARAM) strdup(_name);
int r = SendMessage(_hwnd, LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR *)(&lvi));
ListView_SetItemText(_hwnd, r, 0, _name);
ListView_SetItemText(_hwnd, r, 1, _value);
}
示例7: AddFullResourcesToList
static VOID AddFullResourcesToList(HWND hwnd)
{
PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor;
TCHAR buffer[80];
LVITEM item;
ULONG i;
INT iItem;
for (i = 0; i < resourceValueData->Count; i++)
{
pFullDescriptor = &resourceValueData->List[i];
wsprintf(buffer, _T("%lu"), pFullDescriptor->BusNumber);
item.mask = LVIF_TEXT;
item.iItem = i;
item.iSubItem = 0;
item.state = 0;
item.stateMask = 0;
item.pszText = buffer;
item.cchTextMax = (int)_tcslen(item.pszText);
iItem = ListView_InsertItem(hwnd, &item);
if (iItem != -1)
{
GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80);
ListView_SetItemText(hwnd, iItem, 1, buffer);
}
}
}
示例8: lstrcpy
void VerticalFileSwitcherListView::setItemIconStatus(int bufferID)
{
Buffer *buf = (Buffer *)bufferID;
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(buf->getFileName()));
::PathRemoveExtension(fn);
LVITEM item;
item.pszText = fn;
item.iSubItem = 0;
item.iImage = buf->getUserReadOnly()||buf->getFileReadOnly()?2:(buf->isDirty()?1:0);
int nbItem = ListView_GetItemCount(_hSelf);
for (int i = 0 ; i < nbItem ; i++)
{
item.mask = LVIF_PARAM;
item.iItem = i;
ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)(item.lParam);
if (int(tlfs->_bufID) == bufferID)
{
item.mask = LVIF_TEXT | LVIF_IMAGE;
ListView_SetItem(_hSelf, &item);
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(buf->getFileName()));
}
}
}
示例9: LoadReplacements
static void LoadReplacements(HWND hwndDlg)
{
HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS);
ListView_DeleteAllItems(hList);
ListView_SetItemCount(hList, 0);
int sel = SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETCURSEL, 0, 0);
if (sel < 0)
return;
AutoreplaceData *data = (AutoreplaceData *) SendDlgItemMessage(hwndDlg, IDC_LANGUAGE, CB_GETITEMDATA, sel, 0);
if (!data->initialized) {
data->dict->autoReplace->copyMap(&data->autoReplaceMap);
data->initialized = TRUE;
}
map<tstring,AutoReplacement>::iterator it = data->autoReplaceMap.begin();
for(int i = 0; it != data->autoReplaceMap.end(); it++, i++) {
LVITEM item = {0};
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = i;
item.iSubItem = 0;
item.pszText = (TCHAR *) it->first.c_str();
item.cchTextMax = (int)it->first.length();
item.lParam = i;
ListView_InsertItem(hList, &item);
ListView_SetItemText(hList, i, 1, (TCHAR *) it->second.replace.c_str());
}
EnableDisableCtrls(hwndDlg);
}
示例10: PSList
void PSList() {
HANDLE hSnapshot;
PROCESSENTRY32 pEntry;
char flag;
char procID[10];
LVITEM LI;
int ListCnt=0;
hSnapshot=CreateToolhelp32Snapshot(TH32CS_SNAPALL,NULL);
pEntry.dwSize=sizeof(pEntry);
flag=Process32First(hSnapshot,&pEntry);
while(flag) {
ListCnt=ListView_GetItemCount(hListPS);
LI.mask=LVIF_TEXT|LVIF_PARAM;
LI.iItem=ListCnt;
LI.iSubItem=0;
LI.pszText=pEntry.szExeFile;
ListView_InsertItem(hListPS,&LI);
sprintf_s(procID,"%d",pEntry.th32ProcessID);
ListView_SetItemText(hListPS,ListCnt,1,procID);
flag=Process32Next(hSnapshot,&pEntry);
}
CloseHandle(hSnapshot);
ListView_SetExtendedListViewStyle(hListPS,LVS_EX_FULLROWSELECT);
}
示例11: AddListViewItems
/* ************************************
* BOOL AddListViewItems(HWND hwndListView)
* 功能 为List View增加项
* 参数 hwndListView,父窗口
* 返回值 窗口句柄
**************************************/
BOOL AddListViewItems(HWND hwndListView)
{
LVITEM lvI;
DWORD index;
ZeroMemory (&lvI,sizeof(lvI));
// 有效的项
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
// 填充LVITEM
lvI.state = 0;
lvI.stateMask = 0;
// 循环增加
for (index = 0; index < 3; index++)
{
lvI.iItem = index;
lvI.iImage = 0;
lvI.iSubItem = 0;
// 项的文本和长度
lvI.pszText = "name1";
lvI.cchTextMax = lstrlen(lvI.pszText)+1;
// 插入项
if(ListView_InsertItem(hwndListView, &lvI) == -1)
return FALSE;
// 设置子项的文本,0 based
ListView_SetItemText(hwndListView, index, 2, "size a");
}
return TRUE;
}
示例12: InsertLogMsg
void InsertLogMsg(LPTSTR lpszMsg)
{
int nCount = AddNewLogMsg();
ListView_SetItemText(g_hLogMsgWnd, nCount, 2, lpszMsg);
ListView_Scroll(g_hLogMsgWnd, 0, 8);
}
示例13: ListView_GetItemState
void CPpcMainWnd::SortFile(int nSort)
{
#define CURRENT_MASK 0x8000
int i, nFocus = -1;
FILEINFO* p;
TCHAR szTitle[MAX_PATH];
for (i = 0; i < m_pListFile->GetCount(); i++) {
p = (FILEINFO*)m_pListFile->GetAt(i);
p->dwUser = (i == m_nCurrent) ? CURRENT_MASK : 0;
p->dwUser |= ListView_GetItemState(m_hwndLV, i, LVIS_FOCUSED | LVIS_SELECTED);
}
m_pListFile->Sort(SortCompareProc, nSort);
for (i = 0; i < m_pListFile->GetCount(); i++) {
p = (FILEINFO*)m_pListFile->GetAt(i);
if (p->dwUser & CURRENT_MASK)
m_nCurrent = i;
GetTitle(i, szTitle);
ListView_SetItemText(m_hwndLV, i, 0, szTitle);
ListView_SetItemState(m_hwndLV, i, p->dwUser, LVIS_FOCUSED | LVIS_SELECTED);
if (p->dwUser &LVIS_FOCUSED)
nFocus = i;
}
if (nFocus != -1)
ListView_EnsureVisible(m_hwndLV, nFocus, FALSE);
UpdateTrack();
}
示例14: TaskLstFnStatus
void VerticalFileSwitcherListView::initList()
{
TaskListInfo taskListInfo;
::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE);
for (size_t i = 0 ; i < taskListInfo._tlfsLst.size() ; i++)
{
TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i];
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
::PathRemoveExtension(fn);
LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
item.pszText = fn;
item.iItem = i;
item.iSubItem = 0;
item.iImage = fileNameStatus._status;
item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item);
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(fileNameStatus._fn.c_str()));
}
}
示例15: ListView_GetItemCount
int VerticalFileSwitcherListView::add(int bufferID, int iView)
{
int index = ListView_GetItemCount(_hSelf);
Buffer *buf = (Buffer *)bufferID;
const TCHAR *fileName = buf->getFileName();
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, fileName, 0, (void *)bufferID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileName));
::PathRemoveExtension(fn);
LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
item.pszText = fn;
item.iItem = index;
item.iSubItem = 0;
item.iImage = buf->getUserReadOnly()||buf->getFileReadOnly()?2:(buf->isDirty()?1:0);
item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item);
ListView_SetItemText(_hSelf, index, 1, ::PathFindExtension(fileName));
ListView_SetItemState(_hSelf, index, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
return index;
}