Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

cRegistry problems read/writing to (Default)
Hello,

I'm attempting to read the value of a default into a variable.  It's
simply not working.


Private Sub Command1_Click()

Dim cr As New cRegistry

With cr
.ClassKey = HKEY_CURRENT_USER
.SectionKey =
" HKEY_CURRENT_USER\AppEvents\Schemes\Apps
\Explorer\Navigating\.Current"
.ValueKey = "" 'value is (Default)
.ValueType = REG_SZ
OldNavigationSound = .Value
End With

Text1.Text = OldNavigationSound

End Sub


Any suggestions?


OldNavigationSound is a Global.


Thanks,

Matt


Report this thread to moderator Post Follow-up to this message
Old Post
MatthewBrown@gmail.com
01-28-06 11:55 PM


Re: cRegistry problems read/writing to (Default)
BAHHHHH! Typo.

Private Sub Command1_Click()

Dim cr As New cRegistry

With cr
.ClassKey = HKEY_CURRENT_USER
.SectionKey =
" AppEvents\Schemes\Apps\Explorer\Navigati
ng\.Current"
.ValueKey = "" 'value is (Default)
.ValueType = REG_SZ
OldNavigationSound = .Value
End With

Text1.Text = OldNavigationSound

End Sub


Report this thread to moderator Post Follow-up to this message
Old Post
MatthewBrown@gmail.com
01-28-06 11:55 PM


Re: cRegistry problems read/writing to (Default)
On 28 Jan 2006 14:23:41 -0800, MatthewBrown@gmail.com wrote:

>I'm attempting to read the value of a default into a variable.  It's
>simply not working.
>
>
>Private Sub Command1_Click()
>
>Dim cr As New cRegistry
>
>        With cr
>            .ClassKey = HKEY_CURRENT_USER
>            .SectionKey =
>" HKEY_CURRENT_USER\AppEvents\Schemes\Apps
\Explorer\Navigating\.Current"
>            .ValueKey = "" 'value is (Default)
>            .ValueType = REG_SZ
>            OldNavigationSound = .Value
>        End With
>
>Text1.Text = OldNavigationSound
>
>End Sub
>
>
>Any suggestions?

Hard to tell for sure without seeing code behind cRegistry, however a
~guess~ would be .ValueKey. The default valuename for a key is not
really an empty string (even though it ~looks~ that way in Regedit),
but rather a NULL (in Api lingo), or typically vbNullString with VB.
It's possible the code in cRegistry is just passing the empty string
to the underlying Api. I know in my own reg class I make a special
case exception for "" to specify the default valuename. Setting the
.ValueKey prop to vbNullString ~might~ work (worth a try anyway), but
it may still end up as an empty string by the time it's washed through
the arg and the cRegistry code passes it along to the Api. Anyway this
is just a guess, but if that's whats happening you may have to resort
to using the Reg Api directly or a component that specifically
provides a way to set te default valuename.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)

Report this thread to moderator Post Follow-up to this message
Old Post
Tom Esh
01-29-06 02:55 AM


Re: cRegistry problems read/writing to (Default)
thanks for your response.  I was having a lot of trouble understanding
calling with variables.

I'm in the middle of testing storing the original navigation sound in a
public variable and then clearing it while the program is running, then
setting it back to original.


It is stated in cRegistry documentation that to get/set (Default)
values you need to use a "zero length variable."  I was just saying I'm
a moron and set the SectionKey =
" HKEY_CURRENT_USER\AppEvents\Schemes\Apps
\Explorer\Navigating\.Current"

with the HK in there.  Took me over an hour to figure it out.  And
guess what?  I did it again during testing, at least it took me a
half-hour to figure it out this time. :P


Thanks,

Matt


Report this thread to moderator Post Follow-up to this message
Old Post
MatthewBrown@gmail.com
01-29-06 02:55 AM


Re: cRegistry problems read/writing to (Default)
"Tom Esh" <tjeshGibberish@suscom.net> wrote in message
 news:ut4ot1530srcil9eh9u9c6ru3rsthce4cg@
4ax.com...
>
> Hard to tell for sure without seeing code behind cRegistry,.........

Great registry class.

Complete Registry control
http://www.vbaccelerator.com/home/V...rol/article.asp

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm



Report this thread to moderator Post Follow-up to this message
Old Post
Ken Halter
01-29-06 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:14 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.