GetPrivateProfilString()
  Home FAQ Contact Sign in
borland.public.cppbuilder.nativeapi only
 
Advanced search
POPULAR GROUPS

more...

borland.public ... nativeapi Profile…
 Up
GetPrivateProfilString()         


Author: Michael.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;
...
Show full article (1.25Kb)
4 Comments
Re: GetPrivateProfilString()         


Author: Bob Gonder
Date: May 2, 2008 08:33

Michael.Ruehling@t-online.de wrote:
> while (*lpTemp)
> {
> cur = TreeView1->Items->Item[0];
> TreeView1->Items->Add(cur,szBuffer);
> cur = TreeView1->Items->Item[1];
> TreeView1->Items->AddChild(cur,szBuffer);
> }
> 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?

You are adding to node cur. Cur is always 0 or 1.
You want to AddChild to the last Add node:

cur = TreeView1->Items->Item[0];
cur = TreeView1->Items->Add(cur,szBuffer);
TreeView1->Items->AddChild(cur,szBuffer);
no comments
Re: GetPrivateProfilString()         


Author: Remy Lebeau (TeamB)
Date: May 2, 2008 09:37

wrote in message
news:41ul1411o0gb2tnl2dhigfmq95a1bgs165@4ax.com...
> 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:

Try this code instead:

TreeView1->Items->BeginUpdate();
try
{
TreeView1->Items->Clear();

LPTSTR lpBuf = (LPTSTR) LocalAlloc(LPTR, 0x7FFF);
if( lpBuf )
{
TTreeNode *RootNode = TreeView1->Items->Add(NULL, "CDS");
GetPrivateProfileSectionNames(lpBuf, 0x7FFF,
TEXT("CDPLAYER.UNI"));

LPTSTR lpTemp = lpBuf;
TCHAR szBuffer[64];
Show full article (2.60Kb)
no comments
Re: GetPrivateProfilString()         


Author: Michael.Ruehling
Date: May 2, 2008 14:25

Hi,
I will try this at once.

M.
On Fri, 02 May 2008 08:33:21 -0700, Bob Gonder
wrote:
Show full article (0.80Kb)
no comments
Re: GetPrivateProfilString()         


Author: Michael.Ruehling
Date: May 4, 2008 20:08

Hi,
tried this and it works fine for me.
So this ist stage 1.
Next stage will be the sorted output.

Thanks
M.

On Fri, 02 May 2008 23:25:45 +0200, Michael.Ruehling@t-online.de
wrote:
>Hi,
>I will try this at once.
>
>
>M.
>On Fri, 02 May 2008 08:33:21 -0700, Bob Gonder
> wrote:
>
>>Michael.Ruehling@t-online.de wrote:
>>
>>> while (*lpTemp)
>>> {
...
Show full article (1.02Kb)
no comments