🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #336

GetPrivateProfilString()

#336
From: Michael.Ruehling
Date: Fri, 02 May 2008 11:20
42 lines
2258 bytes
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.
Technical Details
Message-ID: <41ul1411o0gb2tnl2dhigfmq95a1bgs165@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeedt0.toon.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7f46e08466844be8,start
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeedt0.toon.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
From: Michael.Ruehling@t-online.de
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: GetPrivateProfilString()
Date: Fri, 02 May 2008 13:20:50 +0200
Organization: T-Online
Lines: 42
Message-ID: <41ul1411o0gb2tnl2dhigfmq95a1bgs165@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.t-online.com 1209727273 00 n28092 A3DUO2Lrknlf-rb 080502 11:21:13
X-Complaints-To: usenet-abuse@t-online.de
X-ID: rCS5MGZcZemb-f8C9z-a6eAKOPkhQwYzg97rEMXDXyYus3k91xv0kJ
X-Newsreader: Forte Agent 1.92/32.572