Board index » cppbuilder » I don't know what's wrong with function TRegistry:GetKeyNames()

I don't know what's wrong with function TRegistry:GetKeyNames()

Hi,
Thanks for your giving directions.

Now my code looks like this,but it can't pass the compiler ,the
error message identify that there is same problem:
[C++ Error] getparameter.cpp(41): E2109 Not an allowed type.
the line 41 is :   if(!Reg->GetKeyNames(ListBox1->Items))
I can't understand the real meaning of the error message.
can you help me?
thank you very much.

LiuXiao

void __fastcall TOKRightDlg1::FormCreate(TObject *Sender)
{
    TRegistry *Reg = NULL;
    try
    {
        Reg = new TRegistry;
        Reg->RootKey = HKEY_LOCAL_MACHINE;

        if(!Reg->OpenKey("\\SOFTWARE",false))
            ShowMessage("Error in Opening Key SOFTWARE");
        else
        {
              ListBox1->Columns=1;
              if(!Reg->GetKeyNames(ListBox1->Items))   //Have Error.
                 ShowMessage("Fuction GetKeyNames Occurs Error!");
              else
                {
                   ListBox1->Items->Add("test1");
                   ListBox1->Items->Add("test2");
                   ListBox1->Items->Add("test3");
                   ListBox1->Repaint();
                }
        }
    }
    __finally
    {
        delete Reg;
    }

Quote
}

 

Re:I don't know what's wrong with function TRegistry:GetKeyNames()


GetKeyNames returns void not bool.
So doing !GetKeyNames(..); is not allowed.

BLa

Quote
"LiuXiao" <liux...@mail.xx.hn.cn> wrote in message news:39487e58@dnews...
> Hi,
> Thanks for your giving directions.

> Now my code looks like this,but it can't pass the compiler ,the
> error message identify that there is same problem:
> [C++ Error] getparameter.cpp(41): E2109 Not an allowed type.
> the line 41 is :   if(!Reg->GetKeyNames(ListBox1->Items))
> I can't understand the real meaning of the error message.
> can you help me?
> thank you very much.

> LiuXiao

> void __fastcall TOKRightDlg1::FormCreate(TObject *Sender)
> {
>     TRegistry *Reg = NULL;
>     try
>     {
>         Reg = new TRegistry;
>         Reg->RootKey = HKEY_LOCAL_MACHINE;

>         if(!Reg->OpenKey("\\SOFTWARE",false))
>             ShowMessage("Error in Opening Key SOFTWARE");
>         else
>         {
>               ListBox1->Columns=1;
>               if(!Reg->GetKeyNames(ListBox1->Items))   file://Have Error.
>                  ShowMessage("Fuction GetKeyNames Occurs Error!");
>               else
>                 {
>                    ListBox1->Items->Add("test1");
>                    ListBox1->Items->Add("test2");
>                    ListBox1->Items->Add("test3");
>                    ListBox1->Repaint();
>                 }
>         }
>     }
>     __finally
>     {
>         delete Reg;
>     }
> }

Re:I don't know what's wrong with function TRegistry:GetKeyNames()


It works,THANK you and Mr.Remy Lebeau!

Quote
"blarsen" <blar...@vestfoldnett.no> wrote in message

news:8i9v8v$eki4@bornews.borland.com...
Quote
> GetKeyNames returns void not bool.
> So doing !GetKeyNames(..); is not allowed.

> BLa

> "LiuXiao" <liux...@mail.xx.hn.cn> wrote in message news:39487e58@dnews...
> > Hi,
> > Thanks for your giving directions.

> > Now my code looks like this,but it can't pass the compiler ,the
> > error message identify that there is same problem:
> > [C++ Error] getparameter.cpp(41): E2109 Not an allowed type.
> > the line 41 is :   if(!Reg->GetKeyNames(ListBox1->Items))
> > I can't understand the real meaning of the error message.
> > can you help me?
> > thank you very much.

> > LiuXiao

> > void __fastcall TOKRightDlg1::FormCreate(TObject *Sender)
> > {
> >     TRegistry *Reg = NULL;
> >     try
> >     {
> >         Reg = new TRegistry;
> >         Reg->RootKey = HKEY_LOCAL_MACHINE;

> >         if(!Reg->OpenKey("\\SOFTWARE",false))
> >             ShowMessage("Error in Opening Key SOFTWARE");
> >         else
> >         {
> >               ListBox1->Columns=1;
> >               if(!Reg->GetKeyNames(ListBox1->Items))   file://Have
Error.
> >                  ShowMessage("Fuction GetKeyNames Occurs Error!");
> >               else
> >                 {
> >                    ListBox1->Items->Add("test1");
> >                    ListBox1->Items->Add("test2");
> >                    ListBox1->Items->Add("test3");
> >                    ListBox1->Repaint();
> >                 }
> >         }
> >     }
> >     __finally
> >     {
> >         delete Reg;
> >     }
> > }

Other Threads