Article View: borland.public.cppbuilder.nativeapi
Article #1886Re: problems of saving a registry key to a file
From: Remy Lebeau (TeamB)
Date: Tue, 29 May 2007 21:38
Date: Tue, 29 May 2007 21:38
32 lines
2044 bytes
2044 bytes
"han" <hanzhangusa@yahoo.com> wrote in message
news:465c9924$1@newsgroups.borland.com...
> I got save key error :0, which I believe it means the operation
> completed successfully.
My mistake. RegOpenKeyEx() and RegSaveKey() do not fill in
GetLastError() at all. The return value is the actual error code
instead:
HKEY hKey;
LONG lResult;
DWORD dwErr;
lResult = RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\XXXCompany\\Settings\\ViewForms", 0, KEY_ALL_ACCESS,
&hKey);
if( lResult == ERROR_SUCCESS )
{
lResult = RegSaveKey(hKey, "tempReg", NULL);
if( lResult != ERROR_SUCCESS )
Application->MessageBox(("save key error: " +
AnsiString(lResult)).c_str(), NULL, MB_OK);
RegCloseKey(hKey);
}
else
Application->MessageBox(("open key error: " +
AnsiString(lResult)).c_str(), NULL, MB_OK);
Gambit
Technical Details
Message-ID:
<465c9dcb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<465a6397@newsgroups.borland.com> <465b4af1$1@newsgroups.borland.com> <465b9222$2@newsgroups.borland.com> <465bf3c5$1@newsgroups.borland.com> <465c84a0$1@newsgroups.borland.com> <465c8700$1@newsgroups.borland.com> <465c9924$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,321743db05a8d51 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <465a6397@newsgroups.borland.com> <465b4af1$1@newsgroups.borland.com> <465b9222$2@newsgroups.borland.com> <465bf3c5$1@newsgroups.borland.com> <465c84a0$1@newsgroups.borland.com> <465c8700$1@newsgroups.borland.com> <465c9924$1@newsgroups.borland.com> Subject: Re: problems of saving a registry key to a file Date: Tue, 29 May 2007 14:38:13 -0700 Lines: 34 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: 75.82.252.126 Message-ID: <465c9dcb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1180474827 75.82.252.126 (29 May 2007 14:40:27 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail