Article View: borland.public.cppbuilder.nativeapi
Article #9436What is the best location to Reg->CloseKey();
From: Edward
Date: Wed, 07 Jul 2004 17:49
Date: Wed, 07 Jul 2004 17:49
90 lines
3023 bytes
3023 bytes
Gambit
1)
if(Reg->OpenKey("\\Software\\Microsoft\\DirectX", false))
{
if(Reg->KeyExists("\\Software\\Microsoft\\DirectX"))
{
}
}
Reg->CloseKey();
2)
if(Reg->OpenKey("\\Software\\Microsoft\\DirectX", false))
{
if(Reg->KeyExists("\\Software\\Microsoft\\DirectX"))
{
}
Reg->CloseKey();
}
2 is the answer?:
TY
Edward
"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> escreveu na
mensagem news:40eb8d7b$1@newsgroups.borland.com...
>
> "Edward" <Registrados2004@aol.com> wrote in message
> news:40eb41eb$1@newsgroups.borland.com...
>
> > What I wound up doing, was something much simpler, but just as
effective.
>
> That won't always work, either.
>
> > while(i < sizeof(biosnro))
> > {
> > biosnro[i] = ' ';
> > i++;
> > }
>
> You could use memset() instead of looping manually.
>
> > Reg->OpenKey("\\HARDWARE\\DESCRIPTION\\System", false);
> > if(Reg->KeyExists("\\HARDWARE\\DESCRIPTION\\System"))
> > {
>
> You should be checking the return value of OpenKey() instead of
KeyExists():
>
> if( Reg->OpenKey("\\HARDWARE\\DESCRIPTION\\System", false) )
> {
>
> > Reg->ReadBinaryData("SystemBiosVersion",&biosnro,sizeof(biosnro));
>
> I just checked on my Win98 machine, and although the key you are using
does
> exist, the particular value you are querying does not. Which means that
> your code would fail on my machine, for instance.
>
> > It doenst work because some times the datavaleu os
> > "SystemBiosVersion" are REG_MULTI_SZ other times
> > REG_SZ and other times are Unknow type
>
> And other times it simply does not exist at all.
>
> > I dont know what more i can do.
>
> If all you want is a unique ID, then why not just generate a new GUID via
> the CoCreateGuid() function? It is already guaranteed to produce a unique
> identifier every time it is called.
>
>
> Gambit
>
>
Technical Details
Message-ID:
<40ec37be@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com> <40eb8d7b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e3066f787953dff9 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Edward" <Registrados2004@aol.com> From: "Edward" <Registrados2004@aol.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com> <40eb8d7b$1@newsgroups.borland.com> Subject: What is the best location to Reg->CloseKey(); Date: Wed, 7 Jul 2004 14:49:48 -0300 Lines: 92 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 200.213.49.155 Message-ID: <40ec37be@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089222590 200.213.49.155 (7 Jul 2004 10:49:50 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail