|
-
Jan 16th, 2002, 04:00 AM
#1
Thread Starter
Hyperactive Member
RegSetValueEx function
Hi all
I want to create string keys and save a string in that key. For this
purpose i am using RegSetValueEx function. But it saves some
junk characters in registry.
I am using it like
VB Code:
strDatabasePath = "d:\Project\FileName"
lngcbdata = lngcbData = Len(strDatabasePath)
' Result is the key identifier
RegSetValueEx Result, "File Path", 0, REG_SZ, strDatabasePath, lngcbData
am i making a mistake?
-
Jan 16th, 2002, 04:59 AM
#2
Re: RegSetValueEx function
yep, you need to change it slightly - add a chr(0) to the end (it's how C expects it, and API functions like this are C based).
VB Code:
lngcbdata = Len(strDatabasePath) + 1
' Result is the key identifier
RegSetValueEx Result, "File Path", 0&, REG_SZ, strDatabasePath & chr(0), lngcbData
-
Jan 16th, 2002, 05:28 AM
#3
Thread Starter
Hyperactive Member
thanks si_the_geek but still the same problem.
-
Jan 16th, 2002, 05:31 AM
#4
Have you set the variable REG_SZ?
It should be:
REG_SZ = &O1
-
Jan 16th, 2002, 05:39 AM
#5
Thread Starter
Hyperactive Member
yes I have.
Even i am assigning the buffer size of string also.
-
Jan 16th, 2002, 05:54 AM
#6
Thread Starter
Hyperactive Member
Done!
Its solved...........
it should be
VB Code:
RegSetValueEx Result, "Database Path", 0&, REG_SZ, ByVal strDatabasePath, lngcbData
that byval was causing all the problem!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|