Group: borland.public.cppbuilder.nativeapi · Group Profile
Author: Michael.RuehlingMichael.Ruehling Date: May 2, 2008 04:20
Hi,
I'm trying to read an Ini-file for an small helperApp. As fas as
creating designing and stuff all works well, but when I#m trying to
read the second level items, all are read in in a single Headnode:
e.g.
[code]
LPTSTR lpTemp;
CHAR szBuffer[64];
LPTSTR lpBuf =
(LPTSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,0x7FFF);
GetPrivateProfileSectionNames(lpBuf, 0x7FFF, "CDPLAYER.UNI");
lpTemp = lpBuf;
TTreeNode *cur;
TreeView1->Items->Clear();
TreeView1->Items->Add(NULL,"CDS");
cur = TreeView1->Items->Item[0];
while (*lpTemp)
{
GetPrivateProfileString(lpTemp,"Artist","Nicht
gefunden",szBuffer,sizeof(szBuffer),"CDPLAYER.UNI");
TreeView1->Items->Add(cur,szBuffer);
cur = TreeView1->Items->Item[1];
GetPrivateProfileString(lpTemp,"Title","Nicht
gefunden",szBuffer,sizeof(szBuffer),"CDPLAYER.UNI");
TreeView1->Items->AddChild(cur,szBuffer);
cur = TreeView1->Items->Item[0];
// TreeView1->Items->Add(cur,"Hallo");
lpTemp += lstrlen(lpTemp)+1;
}
HeapFree(GetProcessHeap(),0,lpBuf);
TreeView1->AlphaSort();
}
Level 1 nodes are created perfectly and level 2 Nodes
are createdt perfectly but are stored under the wrong
head-Nodes. Why? can anyone help?
M.
|