Board index » delphi » TRegistry SaveKey

TRegistry SaveKey

Anyone know what I'm doing wrong hrere? I'm geting error 'This function is
only valid in Win32 mode'.

   if not reg.SaveKey( 'Software/My resistry key', 'mpareg.dat' ) then
      ShowMessage( 'Error saving key - ' + SysErrormessage(
GetLastError ) );

TIA
--

-----Jon Springs-----
M.P.A. Technologies, Inc.
650.548.4777

 

Re:TRegistry SaveKey


Quote
"Jon Springs" <jspri...@jontandshe.org> wrote in message

news:3c587fb2$1_2@dnews...

Quote
> Anyone know what I'm doing wrong hrere? I'm geting error 'This
function is
> only valid in Win32 mode'.

>    if not reg.SaveKey( 'Software/My resistry key',
'mpareg.dat' ) then
>       ShowMessage( 'Error saving key - ' + SysErrormessage(
> GetLastError ) );

That might need to be a backslash instead of a slash...

If that's not it, I would start by making the call a bit more
explicit, to remove as much interpretation as possible.  Does
this work:

reg.SaveKey( '\Software\My resistry key', 'c:\mpareg.dat' )

Re:TRegistry SaveKey


Quote
"Jon Springs" <jspri...@jontandshe.org> wrote:
> Anyone know what I'm doing wrong hrere? I'm geting error 'This function is
> only valid in Win32 mode'.

TRegistry.SaveKey calls ths API RegSaveKey.  Here's what MSDN says about it.
..

"Windows 95/98/Me: RegSaveKey does not support long file names. To save a
registry hive to a file with a long file name, first save the hive to a
short file name, then rename the resulting file to its long file name."

Colin
e-mail :co...@wilsonc.demon.co.uk
web: http://www.wilsonc.demon.co.uk/delphi.htm

Posted with XanaNews

Re:TRegistry SaveKey


Quote
"Jon Springs" <jspri...@jontandshe.org> wrote in message

news:3c59cb10$1_1@dnews...

Quote
> Using backslash had no effect.

Did you try using absolute paths (registry and file) instead of
relative ones?

Re:TRegistry SaveKey


Colin,

'mpatreg.dat' is within the 8.3 rule for names, file name is the second
parameter. Made me look though, and I did violate the 'no extention' for fat
file systems rule. Still get the error msg.

-----Jon-----

Quote
"Colin Wilson" <co...@wilsonc.demon.co.uk> wrote in message

news:3c598aa7$1_1@dnews...
Quote
> "Jon Springs" <jspri...@jontandshe.org> wrote:

> > Anyone know what I'm doing wrong hrere? I'm geting error 'This function
is
> > only valid in Win32 mode'.

> TRegistry.SaveKey calls ths API RegSaveKey.  Here's what MSDN says about
it.
> ..

> "Windows 95/98/Me: RegSaveKey does not support long file names. To save a
> registry hive to a file with a long file name, first save the hive to a
> short file name, then rename the resulting file to its long file name."

> Colin
> e-mail :co...@wilsonc.demon.co.uk
> web: http://www.wilsonc.demon.co.uk/delphi.htm

> Posted with XanaNews

Re:TRegistry SaveKey


Using backslash had no effect.

-----Jon-----

Quote
"Jon Oliver" <joli...@no.spam.maam.com> wrote in message

news:3c597301$1_2@dnews...
Quote

> "Jon Springs" <jspri...@jontandshe.org> wrote in message
> news:3c587fb2$1_2@dnews...
> > Anyone know what I'm doing wrong hrere? I'm geting error 'This
> function is
> > only valid in Win32 mode'.

> >    if not reg.SaveKey( 'Software/My resistry key',
> 'mpareg.dat' ) then
> >       ShowMessage( 'Error saving key - ' + SysErrormessage(
> > GetLastError ) );

> That might need to be a backslash instead of a slash...

> If that's not it, I would start by making the call a bit more
> explicit, to remove as much interpretation as possible.  Does
> this work:

> reg.SaveKey( '\Software\My resistry key', 'c:\mpareg.dat' )

Re:TRegistry SaveKey


Jon,

Nice first name, I completely missed that in the first response.

Yes, I tried absolute on both. Even noticed, with Colin's suggestion about
file name, that I had included an extension, which the docs say you can't do
with FAT file systems.

-----Jon----

P.S. Bet you're a Jonathan, aren't you.

Quote
"Jon Oliver" <joli...@no.spam.maam.com> wrote in message

news:3c59cc1a_1@dnews...
Quote

> "Jon Springs" <jspri...@jontandshe.org> wrote in message
> news:3c59cb10$1_1@dnews...
> > Using backslash had no effect.

> Did you try using absolute paths (registry and file) instead of
> relative ones?

Re:TRegistry SaveKey


Quote
"Jon Springs" <jspri...@jontandshe.org> wrote in message

news:3c5a36ef$1_1@dnews...

Quote
> Jon,

> Nice first name, I completely missed that in the first
response.

> Yes, I tried absolute on both. Even noticed, with Colin's
suggestion about
> file name, that I had included an extension, which the docs
say you can't do
> with FAT file systems.

I'm pretty much out of ideas.  Having to continue, though, I
would keep going towards a simpler mechanism.

For instance, does the save work for any key?  Can you save a
simple, high-level key, that would would not have much depth?

Quote
> P.S. Bet you're a Jonathan, aren't you.

Nope -- my parents are phonetically thrifty.

Other Threads