Article View: borland.public.cppbuilder.nativeapi
Article #1885Re: problems of saving a registry key to a file
From: han
Date: Tue, 29 May 2007 21:20
Date: Tue, 29 May 2007 21:20
47 lines
2371 bytes
2371 bytes
I got save key error :0, which I believe it means the operation completed successfully.
han zhang
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"han" <hanzhangusa@yahoo.com> wrote in message
>news:465c84a0$1@newsgroups.borland.com...
>
>> I tried using GetLastError(), it says the "the Operation completed
>> successfully". It is so strange.
>
>That means that GetLastError() is being cleared before SaveKey()
>exits, probably by RegCloseKey(). So you will have to do what dhoke
>suggested in the .ide newsgroup - use the Win32 API directly instead
>of TRegistry. For example:
>
> 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 )
> {
> dwErr = GetLastError();
> Application->MessageBox(("save key error: " +
>AnsiString(dwErr)).c_str(), NULL, MB_OK);
> }
> RegCloseKey(hKey);
> }
> else
> {
> dwErr = GetLastError();
> Application->MessageBox(("open key error: " +
>AnsiString(dwErr)).c_str(), NULL, MB_OK);
> }
>
>
>Gambit
>
>
Technical Details
Message-ID:
<465c9924$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!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>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: "han" <hanzhangusa@yahoo.com> Sender: "han" <hanzhangusa@yahoo.com> Reply-To: "han" <hanzhangusa@yahoo.com> Subject: Re: problems of saving a registry key to a file Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 64.143.221.52 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> NNTP-Posting-Host: 207.105.83.66 Message-ID: <465c9924$1@newsgroups.borland.com> Date: 29 May 2007 14:20:36 -0700 X-Trace: newsgroups.borland.com 1180473636 207.105.83.66 (29 May 2007 14:20:36 -0700) Lines: 48 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail