本文整理汇总了C++中TreeView_InsertItem函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_InsertItem函数的具体用法?C++ TreeView_InsertItem怎么用?C++ TreeView_InsertItem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TreeView_InsertItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddTocItemToView
static HTREEITEM AddTocItemToView(HWND hwnd, DocTocItem *entry, HTREEITEM parent, bool toggleItem)
{
TV_INSERTSTRUCT tvinsert;
tvinsert.hParent = parent;
tvinsert.hInsertAfter = TVI_LAST;
tvinsert.itemex.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvinsert.itemex.state = entry->child && entry->open != toggleItem ? TVIS_EXPANDED : 0;
tvinsert.itemex.stateMask = TVIS_EXPANDED;
tvinsert.itemex.lParam = (LPARAM)entry;
// Replace unprintable whitespace with regular spaces
str::NormalizeWS(entry->title);
tvinsert.itemex.pszText = entry->title;
#ifdef DISPLAY_TOC_PAGE_NUMBERS
WindowInfo *win = FindWindowInfoByHwnd(hwnd);
if (entry->pageNo && win && win->IsDocLoaded() && !win->AsEbook()) {
ScopedMem<WCHAR> label(win->ctrl->GetPageLabel(entry->pageNo));
ScopedMem<WCHAR> text(str::Format(L"%s %s", entry->title, label));
tvinsert.itemex.pszText = text;
return TreeView_InsertItem(hwnd, &tvinsert);
}
#endif
return TreeView_InsertItem(hwnd, &tvinsert);
}
示例2: GetTVPath
void
FileTransfer::ShowTreeViewItems(HWND hwnd, LPNMTREEVIEW m_lParam)
{
HANDLE m_handle;
WIN32_FIND_DATA m_FindFileData;
TVITEM tvi;
TVINSERTSTRUCT tvins;
char path[rfbMAX_PATH];
GetTVPath(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem, path);
strcat(path, "\\*");
while (TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem) != NULL) {
TreeView_DeleteItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem));
}
SetErrorMode(SEM_FAILCRITICALERRORS);
m_handle = FindFirstFile(path, &m_FindFileData);
SetErrorMode(0);
if (m_handle == INVALID_HANDLE_VALUE) return;
while(1) {
if ((strcmp(m_FindFileData.cFileName, ".") != 0) &&
(strcmp(m_FindFileData.cFileName, "..") != 0)) {
if (m_FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
tvi.mask = TVIF_TEXT;
tvi.pszText = m_FindFileData.cFileName;
tvins.hParent = m_lParam->itemNew.hItem;
tvins.item = tvi;
tvins.hParent = TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
}
}
if (!FindNextFile(m_handle, &m_FindFileData)) break;
}
FindClose(m_handle);
}
示例3: FillSettingsBox
int FillSettingsBox(HWND htree,const char *szModule)
{
DBCONTACTENUMSETTINGS dbces;
HANDOVER hndvr;
HANDLE hcontact;
TVINSERTSTRUCT tvis;
HTREEITEM htvi;
char *pszContact;
hndvr.htree=htree;
hndvr.valid=0;
dbces.lParam=(LPARAM)&hndvr;
dbces.pfnEnumProc=EnumSettings;
dbces.szModule=szModule;
hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
while(hcontact!=NULL)
{
pszContact=strdup((const char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hcontact,0));
tvis.hParent=TVI_ROOT;
tvis.hInsertAfter=TVI_SORT;
tvis.item.mask=TVIF_TEXT|TVIF_PARAM;
tvis.item.pszText=pszContact;
tvis.item.cchTextMax=strlen(pszContact);
tvis.item.lParam=(LPARAM)hcontact;
htvi=TreeView_InsertItem(htree,&tvis);
hndvr.htvi=htvi;
if(CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)hcontact,(LPARAM)&dbces)==-1)
TreeView_DeleteItem(htree,htvi);
hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
}
hcontact=NULL;
pszContact=Translate("Main contact");
tvis.hParent=TVI_ROOT;
tvis.hInsertAfter=TVI_FIRST;
tvis.item.mask=TVIF_TEXT|TVIF_PARAM;
tvis.item.pszText=pszContact;
tvis.item.cchTextMax=strlen(pszContact);
tvis.item.lParam=(LPARAM)NULL;
htvi=TreeView_InsertItem(htree,&tvis);
hndvr.htvi=htvi;
if(CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)hcontact,(LPARAM)&dbces)==-1)
TreeView_DeleteItem(htree,htvi);
return hndvr.valid;
}
示例4: LoadSystemIni
static BOOL
LoadSystemIni(WCHAR * szPath, HWND hDlg)
{
WCHAR szBuffer[BUFFER_SIZE];
HWND hDlgCtrl;
HTREEITEM parent = NULL;
FILE* file;
UINT length;
TVINSERTSTRUCT insert;
wcscpy(szBuffer, szPath);
wcscat(szBuffer, L"\\system.ini");
file = _wfopen(szBuffer, L"rt");
if (!file)
return FALSE;
hDlgCtrl = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
while(!feof(file))
{
if (fgetws(szBuffer, BUFFER_SIZE, file))
{
length = wcslen(szBuffer);
if (length > 1)
{
szBuffer[length] = L'\0';
szBuffer[length - 1] = L'\0';
insert.hInsertAfter = TVI_LAST;
insert.item.mask = TVIF_TEXT;
insert.item.pszText = szBuffer;
if (szBuffer[0] == L';' || szBuffer[0] == L'[')
{
/* Parent */
insert.hParent = NULL;
parent = TreeView_InsertItem(hDlgCtrl, &insert);
}
else
{
/* Child */
insert.hParent = parent;
TreeView_InsertItem(hDlgCtrl, &insert);
}
}
}
}
fclose(file);
return TRUE;
}
示例5: PopulateProtocolList
void PopulateProtocolList(HWND hWnd)
{
bool useOne = IsDlgButtonChecked(hWnd, IDC_USEBYPROTOCOL) == BST_UNCHECKED;
HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST);
TreeView_DeleteAllItems(hLstView);
TVINSERTSTRUCT tvi = {0};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
NudgeElementList *n;
int i = 0;
if (GlobalNudge.useByProtocol)
{
#ifdef _UNICODE
wchar_t buff[256];
#endif
for(n = NudgeList;n != NULL; n = n->next)
{
#ifdef _UNICODE
MultiByteToWideChar(CP_ACP, 0, n->item.ProtocolName, -1, buff, 256);
tvi.item.pszText = buff;
#else
tvi.item.pszText = n->item.ProtocolName;
#endif
tvi.item.iImage = i;
n->item.iProtoNumber = i;
tvi.item.iSelectedImage = i;
tvi.item.state = INDEXTOSTATEIMAGEMASK(n->item.enabled?2:1);
TreeView_InsertItem(hLstView, &tvi);
i++;
}
}
else
{
tvi.item.pszText = TranslateT("Nudge");
tvi.item.iImage = nProtocol;
DefaultNudge.iProtoNumber = nProtocol;
tvi.item.iSelectedImage = nProtocol;
tvi.item.state = INDEXTOSTATEIMAGEMASK(DefaultNudge.enabled?2:1);
TreeView_InsertItem(hLstView, &tvi);
}
TreeView_SelectItem(hLstView, TreeView_GetRoot(hLstView));
//TreeView_SetCheckState(hLstView, TreeView_GetRoot(hLstView), TRUE)
}
示例6: LoadAtlString
void CTedTransformDialog::PopulateCategory(DMOCategory& category)
{
TVINSERTSTRUCT treeInserter;
treeInserter.hParent = TVI_ROOT;
treeInserter.hInsertAfter = TVI_FIRST;
CAtlString strName = LoadAtlString(category.m_nID);
TVITEM item;
item.mask = TVIF_TEXT;
item.pszText = strName.GetBuffer();
item.cchTextMax = strName.GetLength();
treeInserter.item = item;
HTREEITEM hBaseItem = (HTREEITEM) TreeView_InsertItem(m_hList, &treeInserter);
assert(hBaseItem != NULL);
treeInserter.hParent = hBaseItem;
item.mask = TVIF_TEXT | TVIF_PARAM;
DMO_PARTIAL_MEDIATYPE mediaType;
CComPtr<IEnumDMO> spDMOList;
mediaType.type = GUID_NULL;
mediaType.subtype = GUID_NULL;
IMFActivate** ppActivates = NULL;
UINT32 cMFTs = 0;
::MFTEnumEx(category.m_GUID, MFT_ENUM_FLAG_ALL, NULL, NULL, &ppActivates, &cMFTs);
for(DWORD i = 0; i < cMFTs; i++)
{
m_Activates.Add(ppActivates[i]);
LPWSTR pszName = NULL;
ppActivates[i]->GetAllocatedString(MFT_FRIENDLY_NAME_Attribute, &pszName, NULL);
m_strNames.Add(CAtlStringW(pszName));
item.pszText = m_strNames.GetAt(m_strNames.GetCount() - 1).GetBuffer();
item.lParam = (LPARAM) m_Activates.GetCount() - 1;
treeInserter.item = item;
TreeView_InsertItem(m_hList, &treeInserter);
CoTaskMemFree(pszName);
}
CoTaskMemFree(ppActivates);
}
示例7: string_from_mode
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconDlgInfo& entry,
HDC hdc, HICON hicon, NOTIFYICONMODE mode)
{
int idx = _info.size() + 1;
_info[idx] = entry;
String mode_str = string_from_mode(mode);
switch(mode) {
case NIM_SHOW: mode_str = ResString(IDS_NOTIFY_SHOW); break;
case NIM_HIDE: mode_str = ResString(IDS_NOTIFY_HIDE); break;
case NIM_AUTO: mode_str = ResString(IDS_NOTIFY_AUTOHIDE);
}
FmtString txt(TEXT("%s - %s [%s]"), entry._tipText.c_str(), entry._windowTitle.c_str(), mode_str.c_str());
TV_INSERTSTRUCT tvi;
tvi.hParent = hparent;
tvi.hInsertAfter = after;
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tv.lParam = (LPARAM)idx;
tv.pszText = txt.str();
tv.iSelectedImage = tv.iImage = ImageList_AddAlphaIcon(_himl, hicon, GetStockBrush(WHITE_BRUSH), hdc);
(void)TreeView_InsertItem(_tree_ctrl, &tvi);
}
示例8: _ASSERTE
bool CFileGroups::AddFile(HWND hwndTVCtrl, HTREEITEM hGroup, const char *filepath) {
_ASSERTE(hGroup != NULL);
_ASSERTE(filepath != 0);
_ASSERTE(qfileexist(filepath));
if (hGroup == NULL || filepath == 0 || !qfileexist(filepath)) return false;
for (HTREEITEM hChild = TreeView_GetChild(hwndTVCtrl, hGroup);
hChild != NULL; hChild = TreeView_GetNextSibling(hwndTVCtrl, hChild)) {
char text[MAX_PATH];
TVITEMEX tvi;
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.hItem = hGroup;
tvi.pszText = text;
tvi.cchTextMax = sizeof text;
if (TreeView_GetItem(hwndTVCtrl, &tvi)) {
if (_stricmp(filepath, text) == 0) return false; // no dupes!
}
#ifdef _DEBUG
else
_RPTF4(_CRT_ERROR, "%s(%08X, ..., \"%s\"): TreeView_GetItem(%08X, ...) returned NULL",
__FUNCTION__, hwndTVCtrl, filepath, hwndTVCtrl);
#endif // _DEBUG
}
TVINSERTSTRUCT tvis;
tvis.hParent = hGroup;
tvis.hInsertAfter = TVI_SORT;
tvis.itemex.mask = TVIF_TEXT;
tvis.itemex.pszText = const_cast<LPTSTR>(filepath);
const HTREEITEM hti(TreeView_InsertItem(hwndTVCtrl, &tvis));
_ASSERTE(hti != NULL);
return hti != NULL;
}
示例9: InsertIntoTreeView
static HTREEITEM
InsertIntoTreeView(HWND hTreeView,
HTREEITEM hRoot,
LPTSTR lpLabel,
LPTSTR DeviceID,
INT DevImage,
UINT OverlayImage)
{
TV_ITEM tvi;
TV_INSERTSTRUCT tvins;
ZeroMemory(&tvi, sizeof(tvi));
ZeroMemory(&tvins, sizeof(tvins));
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.pszText = lpLabel;
tvi.cchTextMax = lstrlen(lpLabel);
tvi.lParam = (LPARAM)DeviceID;
tvi.iImage = DevImage;
tvi.iSelectedImage = DevImage;
if (OverlayImage != 0)
{
tvi.mask |= TVIF_STATE;
tvi.stateMask = TVIS_OVERLAYMASK;
tvi.state = INDEXTOOVERLAYMASK(OverlayImage);
}
tvins.item = tvi;
tvins.hParent = hRoot;
return TreeView_InsertItem(hTreeView, &tvins);
}
示例10: ZeroMemory
HTREEITEM
CDeviceView::InsertIntoTreeView(
_In_ HTREEITEM hParent,
_In_z_ LPWSTR lpLabel,
_In_ LPARAM lParam,
_In_ INT DevImage,
_In_ UINT OverlayImage
)
{
TV_ITEMW tvi;
TV_INSERTSTRUCT tvins;
ZeroMemory(&tvi, sizeof(tvi));
ZeroMemory(&tvins, sizeof(tvins));
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.pszText = lpLabel;
tvi.cchTextMax = wcslen(lpLabel);
tvi.lParam = lParam;
tvi.iImage = DevImage;
tvi.iSelectedImage = DevImage;
if (OverlayImage != 0)
{
tvi.mask |= TVIF_STATE;
tvi.stateMask = TVIS_OVERLAYMASK;
tvi.state = INDEXTOOVERLAYMASK(OverlayImage);
}
tvins.item = tvi;
tvins.hParent = hParent;
return TreeView_InsertItem(m_hTreeView, &tvins);
}
示例11: initRootItems
void Manager::fillTree()
{
initRootItems();
TVINSERTSTRUCT tvi = { 0 };
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
tvi.item.state = TreeItem::_UNCHECKED();
mir_cslock lock(DBEntry::mutexDB);
DBEntry *entry = DBEntry::getFirst();
while (entry != NULL) {
if ((UINT)entry->m_iFtpNum < m_rootItems.size()) {
tvi.item.pszText = mir_a2t(entry->m_szFileName);
tvi.hParent = m_rootItems[entry->m_iFtpNum]->m_handle;
HTREEITEM hItem = TreeView_InsertItem(m_hwndFileTree, &tvi);
AddLeaf(hItem, tvi.hParent, entry->m_fileID);
FREE(tvi.item.pszText);
}
entry = DBEntry::getNext(entry);
}
}
示例12: AddToObjectTree
void AddToObjectTree(HTREEITEM hParent, Class *cls)
{
traceIn(AddToObjectTree);
static TVINSERTSTRUCT tvis;
if(cls == GetClass(EditorObject))
return;
zero(&tvis, sizeof(TVINSERTSTRUCT));
tvis.hParent = hParent;
tvis.hInsertAfter = TVI_SORT;
tvis.itemex.mask = TVIF_TEXT|TVIF_PARAM;
tvis.itemex.pszText = (TSTR)cls->GetName();
tvis.itemex.lParam = (LPARAM)cls;
HTREEITEM hItem = TreeView_InsertItem(hwndObjectTree, &tvis);
List<Class*> Children;
Class::GetClassChildren(cls, Children);
for(DWORD i=0; i<Children.Num(); i++)
AddToObjectTree(hItem, Children[i]);
if(hParent == NULL)
TreeView_Expand(hwndObjectTree, hItem, TVE_EXPAND);
traceOut;
}
示例13: FullStackInsertData
VOID
FullStackInsertData(
__in PDIALOG_OBJECT Object,
__in PFULLSTACK_CONTEXT Context,
__in PTREELIST_OBJECT TreeList
)
{
PBTR_CPU_RECORD Record;
HWND hWndTree;
PBTR_CPU_SAMPLE Sample;
TVINSERTSTRUCT tvi = {0};
ULONG Number;
HTREEITEM hItem;
WCHAR Buffer[16];
Record = Context->Record;
hWndTree = TreeList->hWndTree;
for(Number = 0; Number < Record->ActiveCount + Record->RetireCount; Number += 1) {
Sample = &Record->Sample[Number];
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM;
StringCchPrintf(Buffer, 16, L"%u", Sample->ThreadId);
tvi.item.pszText = Buffer;
tvi.item.lParam = (LPARAM)Sample;
hItem = TreeView_InsertItem(hWndTree, &tvi);
FullStackInsertBackTrace(Context, hWndTree, hItem, Sample);
}
}
示例14: MoveItemAbove
HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsertAfter)
{
TVITEM tvi={0};
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hItem;
if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi))
return NULL;
if (hItem && hInsertAfter) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
if (hItem == hInsertAfter)
return hItem;
tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvis.item.stateMask=0xFFFFFFFF;
tvis.item.pszText=name;
tvis.item.cchTextMax=sizeof(name);
tvis.item.hItem=hItem;
tvis.item.iImage=tvis.item.iSelectedImage=((MenuItemOptData *)tvi.lParam)->show;
if(!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
return NULL;
if (!TreeView_DeleteItem(hTreeWnd,hItem))
return NULL;
tvis.hParent=NULL;
tvis.hInsertAfter=hInsertAfter;
return TreeView_InsertItem(hTreeWnd, &tvis);
}
return NULL;
}
示例15: InsertSeparator
static int InsertSeparator(HWND hwndDlg)
{
MenuItemOptData *PD;
TVINSERTSTRUCT tvis = {0};
TVITEM tvi = {0};
HTREEITEM hti = {0};
HWND hMenuTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
hti = TreeView_GetSelection( hMenuTree );
if ( hti == NULL )
return 1;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti;
if ( TreeView_GetItem( hMenuTree, &tvi) == FALSE )
return 1;
PD = ( MenuItemOptData* )mir_alloc( sizeof( MenuItemOptData ));
ZeroMemory( PD, sizeof( MenuItemOptData ));
PD->id = -1;
PD->name = mir_tstrdup( STR_SEPARATOR );
PD->show = TRUE;
PD->pos = ((MenuItemOptData *)tvi.lParam)->pos-1;
tvis.item.lParam = (LPARAM)(PD);
tvis.item.pszText = PD->name;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
tvis.hParent = NULL;
tvis.hInsertAfter = hti;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
TreeView_InsertItem( hMenuTree, &tvis );
return 1;
}